Changeset 11 in libcf++ for trunk/src/bin.cpp
- Timestamp:
- 06/08/15 21:27:49 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bin.cpp
r10 r11 15 15 } 16 16 17 cf::bin::bin(const cf::char_t * in) 17 cf::bin::bin(const std::string & in) 18 : mBin(in.begin(), in.end()) 18 19 { 19 if (!in)20 return;21 22 set(reinterpret_cast<const cf::uint8_t *>(in),23 strlen(reinterpret_cast<const char *>(in)));24 20 } 25 21 … … 98 94 } 99 95 96 cf::bin & cf::bin::operator =(const std::string & in) 97 { 98 mBin.assign(in.begin(), in.end()); 99 return *this; 100 } 101 100 102 cf::void_t cf::bin::operator +=(const cf::bin & in) 101 103 { … … 122 124 } 123 125 126 cf::uint8_t cf::bin::operator [](const cf::size_t index) const 127 { 128 if (index > size()) 129 THROW_EXCEPTION("invalid index"); 130 131 return mBin[index]; 132 } 133 124 134 cf::size_t cf::bin::find(const cf::uint8_t * in, 125 135 const cf::size_t length) const … … 137 147 138 148 return -1; 149 } 150 151 std::string cf::bin::toString() const 152 { 153 return std::string(mBin.begin(), mBin.end()); 139 154 } 140 155
Note:
See TracChangeset
for help on using the changeset viewer.