Nemiver  0.3
nmv-buffer.h
Go to the documentation of this file.
1 /* -*- Mode: C++; indent-tabs-mode:nil; c-basic-offset:4; -*- */
2 
3 /*
4  *This file is part of the Nemiver Project.
5  *
6  *Nemiver is free software; you can redistribute
7  *it and/or modify it under the terms of
8  *the GNU General Public License as published by the
9  *Free Software Foundation; either version 2,
10  *or (at your option) any later version.
11  *
12  *Nemiver is distributed in the hope that it will
13  *be useful, but WITHOUT ANY WARRANTY;
14  *without even the implied warranty of
15  *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  *See the GNU General Public License for more details.
17  *
18  *You should have received a copy of the
19  *GNU General Public License along with Nemiver;
20  *see the file COPYING.
21  *If not, write to the Free Software Foundation,
22  *Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23  *
24  *See COPYRIGHT file copyright information.
25  */
26 #ifndef __NMV_BUFFER_H__
27 #define __NMV_BUFFER_H__
28 
29 #include "nmv-api-macros.h"
30 
31 namespace nemiver {
32 namespace common {
33 
35  char * m_data;
36  unsigned long m_len;
37 
38 public:
39 
40  Buffer (): m_data (0), m_len (0)
41  {}
42 
43  Buffer (const char *a_buf, unsigned long a_len)
44  {
45  m_data = const_cast<char*>(a_buf);
46  m_len = a_len;
47  }
48 
49  Buffer (const Buffer &a_buf) : m_data (a_buf.m_data), m_len (a_buf.m_len)
50  {}
51 
52  void set
53  (const char* a_buf, unsigned long a_len)
54  {
55  m_data = const_cast<char*> (a_buf);
56  m_len = a_len;
57  }
58 
59  Buffer& operator= (Buffer &a_buf)
60  {
61  if (this == &a_buf)
62  return *this;
63  m_data = a_buf.m_data;
64  m_len = a_buf.m_len;
65  return *this;
66  }
67 
68  const char* get_data () const
69  {
70  return m_data;
71  }
72 
73  unsigned long get_len () const
74  {
75  return m_len;
76  }
77 };//end class Bufer
78 
79 }//end namespace common
80 }//end namespace nemiver
81 
82 #endif //__NMV_BUFFER_H__
83 
nemiver::common::Buffer::Buffer
Buffer(const char *a_buf, unsigned long a_len)
Definition: nmv-buffer.h:43
nemiver
Definition: nmv-address.h:31
NEMIVER_API
#define NEMIVER_API
Definition: nmv-api-macros.h:53
nmv-api-macros.h
nemiver::common::Buffer::Buffer
Buffer()
Definition: nmv-buffer.h:40
nemiver::common::Buffer::get_len
unsigned long get_len() const
Definition: nmv-buffer.h:73
nemiver::common::Buffer::Buffer
Buffer(const Buffer &a_buf)
Definition: nmv-buffer.h:49
nemiver::common::Buffer
Definition: nmv-buffer.h:34
nemiver::common::Buffer::get_data
const char * get_data() const
Definition: nmv-buffer.h:68
common
Definition: nmv-proc-list-dialog.h:32