Skip to content

Commit d764e5e

Browse files
committed
remove deprecated class CString.
1 parent 3b41623 commit d764e5e

File tree

13 files changed

+382
-726
lines changed

13 files changed

+382
-726
lines changed

build/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,9 @@ SET ( cppcore_src
7575

7676
SET ( cppcore_common_src
7777
../include/cppcore/Common/Hash.h
78-
../include/cppcore/Common/CString.h
7978
../include/cppcore/Common/TStringBase.h
8079
../include/cppcore/Common/TSharedPtr.h
8180
../include/cppcore/Common/Variant.h
82-
../code/Common/CString.cpp
8381
)
8482

8583
SET( cppcore_random_src
@@ -131,7 +129,6 @@ IF( BUILD_UNITTESTS )
131129

132130
SET( cppcore_common_test_src
133131
../test/common/HashTest.cpp
134-
../test/common/StringTest.cpp
135132
../test/common/VariantTest.cpp
136133
../test/common/TSharedPtrTest.cpp
137134
)

code/Common/CString.cpp

Lines changed: 0 additions & 121 deletions
This file was deleted.

include/cppcore/Common/CString.h

Lines changed: 0 additions & 79 deletions
This file was deleted.

include/cppcore/Common/Hash.h

Lines changed: 25 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2323
#pragma once
2424

2525
#include <cppcore/CPPCoreCommon.h>
26-
#include <cppcore/Common/CString.h>
2726

2827
namespace CPPCore {
2928

@@ -40,38 +39,32 @@ class Hash {
4039

4140
/// @brief The class constructor with a given hash value.
4241
/// @param hash [in] An integer value to compute the hash from.
43-
explicit Hash( unsigned int hash );
42+
explicit Hash(unsigned int hash);
4443

4544
/// @brief The class constructor with a given char buffer.
4645
/// @param value [in] A character buffer to compute the hash from.
4746
/// @param base [in] The table base.
48-
explicit Hash( const char *buffer, unsigned int base );
49-
47+
explicit Hash(const char *buffer, unsigned int base);
48+
5049
/// @brief The class constructor with a given unsigned int value.
5150
/// @param value [in] An unsigned int value to compute the hash from.
5251
/// @param base [in] The table base.
53-
explicit Hash( unsigned int value, unsigned int base );
52+
explicit Hash(unsigned int value, unsigned int base);
5453

5554
/// @brief The class destructor.
5655
~Hash();
5756

58-
/// @brief Computes the hash value for a given string.
59-
/// @param key [in] The string.
60-
/// @param base [in] The table base.
61-
/// @return The hash value.
62-
static unsigned int toHash( const CString &key, unsigned int base );
63-
6457
/// @brief Computes the hash value for a given character buffer.
6558
/// @param buffer [in] The buffer.
6659
/// @param base [in] The table base.
6760
/// @return The hash value.
68-
static unsigned int toHash( const char *buffer, unsigned int base );
61+
static unsigned int toHash(const char *buffer, unsigned int base);
6962

7063
/// @brief Computes the hash value for a given unsigned int value.
7164
/// @param buffer [in] The unsigned int value.
7265
/// @param base [in] The table base.
7366
/// @return The hash value.
74-
static unsigned int toHash( unsigned int value, unsigned int base );
67+
static unsigned int toHash(unsigned int value, unsigned int base);
7568

7669
/// brief Returns the stored hash value.
7770
/// @return The hash value.
@@ -81,64 +74,51 @@ class Hash {
8174
unsigned int m_hash;
8275
};
8376

84-
inline
85-
Hash::Hash()
86-
: m_hash( 0 ){
77+
inline Hash::Hash() :
78+
m_hash(0) {
8779
// empty
8880
}
8981

90-
inline
91-
Hash::Hash( unsigned int hash )
92-
: m_hash( hash ) {
82+
inline Hash::Hash(unsigned int hash) :
83+
m_hash(hash) {
9384
// empty
9485
}
9586

96-
inline
97-
Hash::Hash( const char *buffer, unsigned int base )
98-
: m_hash( Hash::toHash( buffer, base ) ) {
87+
inline Hash::Hash(const char *buffer, unsigned int base) :
88+
m_hash(Hash::toHash(buffer, base)) {
9989
// empty
10090
}
10191

102-
inline
103-
Hash::Hash( unsigned int value, unsigned int base )
104-
: m_hash( Hash::toHash( value, base ) ) {
92+
inline Hash::Hash(unsigned int value, unsigned int base) :
93+
m_hash(Hash::toHash(value, base)) {
10594
// empty
10695
}
10796

108-
inline
109-
Hash::~Hash() {
97+
inline Hash::~Hash() {
11098
// empty
11199
}
112100

113-
inline
114-
unsigned int Hash::toHash( const CString &key, unsigned int base ) {
115-
return toHash( key.c_str(), base );
116-
}
117-
118-
inline
119-
unsigned int Hash::toHash( const char *buffer, unsigned int base ) {
120-
unsigned int hash( 0 );
121-
if( nullptr == buffer ) {
101+
inline unsigned int Hash::toHash(const char *buffer, unsigned int base) {
102+
unsigned int hash(0);
103+
if (nullptr == buffer) {
122104
return hash;
123105
}
124-
106+
125107
// using division-rest method
126108
// see http://de.wikipedia.org/wiki/Divisionsrestmethode
127-
for( size_t i = 0; i < strlen( buffer ); ++i ) {
128-
hash = ( hash * 128 + buffer[ i ] ) % base;
109+
for (size_t i = 0; i < strlen(buffer); ++i) {
110+
hash = (hash * 128 + buffer[i]) % base;
129111
}
130-
112+
131113
return hash;
132114
}
133115

134-
inline
135-
unsigned int Hash::toHash( unsigned int value, unsigned int base ) {
136-
const unsigned int hash( value % base );
116+
inline unsigned int Hash::toHash(unsigned int value, unsigned int base) {
117+
const unsigned int hash(value % base);
137118
return hash;
138119
}
139120

140-
inline
141-
unsigned int Hash::hashValue() const {
121+
inline unsigned int Hash::hashValue() const {
142122
return m_hash;
143123
}
144124

0 commit comments

Comments
 (0)