Imported Upstream version 878.70.2
[platform/upstream/mdnsresponder.git] / mDNSMacOSX / BonjourTop / source / bjstring.h
1 //
2 //  bjstring.h
3 //  TestTB
4 //
5 //  Created by Terrin Eager on 9/26/12.
6 //
7 //
8
9 #ifndef __TestTB__bjstring__
10 #define __TestTB__bjstring__
11
12 #include <iostream>
13 #include "bjtypes.h"
14
15 class BJString
16 {
17
18 public:
19     BJString();
20     BJString(const BJString& scr);
21     BJString(const char* str);
22     virtual ~BJString();
23
24     BJString& operator=(const char* str);
25     BJString& operator=(const BJString& str);
26     bool operator==(const char* str);
27     bool operator!=(const char* str){return !operator==(str);};
28     bool operator==(const BJString& str);
29     bool operator!=(const BJString& str) {return !operator==(str);};
30     bool operator<(const BJString& str) const;
31
32     BJ_COMPARE Compare(const BJString& str);
33
34
35     BJString& operator+=(const char* str);
36     BJString& operator+=(const BJString& str);
37
38     const char* GetBuffer() const;
39
40     void Set(const char* str);
41     void Set(const char* str,BJ_UINT32 len);
42
43     void Append(const char* str, BJ_UINT32 len);
44
45     bool Contains(const char* str);
46
47     BJ_UINT32 GetUINT32();
48
49     enum BJ_FORMAT_STYLE {BJSS_BYTE,BJSS_TIME} ;
50     void Format(BJ_UINT64 number,BJ_FORMAT_STYLE style);
51
52     BJ_UINT32 GetLength();
53
54     BJ_UINT32 GetBufferLength(){return length;};
55
56 private:
57
58     void Create(BJ_UINT32 len);
59     char* buffer;
60     BJ_UINT32 length;
61 };
62
63 #endif /* defined(__TestTB__bjstring__) */