Add cast to eliminate msvc warning
[gssweb.git] / json_gssapi / src / datamodel / GSSBuffer.h
1 /*
2  * Copyright (c) 2014 <copyright holder> <email>
3  * 
4  * For license details, see the LICENSE file in the root of this project.
5  * 
6  */
7
8 #ifndef GSSBUFFER_H
9 #define GSSBUFFER_H
10
11 #include <string>
12 #include "gssapi.h"
13 #include <iostream>
14
15 class GSSBuffer {
16 public:
17   GSSBuffer(std::string str = "", bool gssInternal = false);
18   GSSBuffer(char *str, bool gssInternal = false);
19   GSSBuffer(char *str, int len, bool gssInternal = false);
20   GSSBuffer(gss_buffer_t gssbuf, bool gssInternal = false);
21   GSSBuffer(const GSSBuffer &other);
22   ~GSSBuffer(void);
23   
24   std::string toString() const { return(std::string((char *)buf->value, buf->length)); }
25   gss_buffer_t toGss() const { return( buf ); }
26   int length() const { return((int )buf->length); }
27   
28   void setValue(std::string str);
29   void setValue(char *str);
30   void setValue(char *str, int len);
31   void setValue(gss_buffer_t gssbuf);
32   
33   bool operator==(GSSBuffer B) const { return(this->toString() == B.toString()); }
34
35 private:
36   gss_buffer_t buf;
37   bool         gssInternal;
38   
39   void freeBufValue();
40   void initEmpty();
41 };
42
43
44
45
46 #endif // GSSBUFFER_H