Skip to content

Commit a71a4ec

Browse files
committed
- Refactoring
1 parent 6963e92 commit a71a4ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2660
-2784
lines changed

cldeplus/CMakeLists.txt

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,47 @@
11

2+
23
# FOUNDATION SOURCE
34
set(FOUNDATION_SOURCE
4-
Cell.cpp
5-
Column.cpp
6-
Entity.cpp
7-
EntityMap.cpp
8-
EntityProxy.cpp
9-
EntityQuery.cpp
10-
EntitySourceDriver.cpp
11-
EntityStore.cpp
12-
Identity.cpp)
5+
Exception.cpp
6+
Exceptions/NonSupportedFunctionException.cpp
7+
Exceptions/NotImplementedException.cpp
8+
Value.cpp
9+
ValueFactory.cpp
10+
Primitive.cpp
11+
Data/DataTypeException.cpp
12+
Data/NumericValue.cpp
13+
Data/CharacterValue.cpp
14+
Data/TimeBasedValue.cpp
15+
Data/Type/Boolean.cpp
16+
Data/Type/Byte.cpp
17+
Data/Type/Date.cpp
18+
Data/Type/DateTime.cpp
19+
Data/Type/Double.cpp
20+
Data/Type/Float.cpp
21+
Data/Type/Int16.cpp
22+
Data/Type/Int32.cpp
23+
Data/Type/Int64.cpp
24+
Data/Type/UInt16.cpp
25+
Data/Type/UInt32.cpp
26+
Data/Type/UInt64.cpp
27+
Data/Type/String.cpp
28+
Data/Type/Text.cpp
29+
Data/Type/Time.cpp
30+
Data/Type/UInt16.cpp
31+
Data/Type/UInt32.cpp
32+
Data/Type/UInt64.cpp
33+
Data/Type/VarChar.cpp
34+
Data/Helper/TimeBasedHelper.cpp
35+
# Cell.cpp
36+
# Column.cpp
37+
# Entity.cpp
38+
# EntityMap.cpp
39+
# EntityProxy.cpp
40+
# EntityQuery.cpp
41+
# EntitySourceDriver.cpp
42+
# EntityStore.cpp
43+
# Identity.cpp
44+
)
1345

1446

1547
# MAIN TARGETS

cldeplus/Data/CharacterValue.cpp

Lines changed: 54 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -16,82 +16,81 @@ limitations under the License.
1616
1717
*/
1818

19+
#include "DataTypeException.h"
1920
#include "CharacterValue.h"
2021

2122
namespace CLDEPlus {
22-
namespace Foundation {
23-
namespace Data {
23+
namespace Data {
2424

25-
CharacterValue::CharacterValue(ValueType dataType, size_t size)
26-
: Value(dataType, size) {
27-
//
28-
}
25+
CharacterValue::CharacterValue(ValueType dataType, size_t size)
26+
: Value(dataType, size) {
27+
//
28+
}
2929

30-
ValueCategory CharacterValue::_category = ValueCategory::CharacterBased;
30+
ValueCategory CharacterValue::_category = ValueCategory::CharacterBased;
3131

32-
const ValueCategory &CharacterValue::getCategory() const {
33-
return _category;
34-
}
32+
const ValueCategory &CharacterValue::getCategory() const {
33+
return _category;
34+
}
3535

36-
bool CharacterValue::isNumeric() const {
37-
return false;
38-
}
36+
bool CharacterValue::isNumeric() const {
37+
return false;
38+
}
3939

40-
Value &CharacterValue::operator+(const Value &rhs) {
41-
throw Exception::CLDENonSupportedFunctionException("operator+ can not be applied to CharacterValue type");
42-
}
40+
Value &CharacterValue::operator+(const Value &rhs) {
41+
throw DataTypeException("operator+ can not be applied to CharacterValue type");
42+
}
4343

44-
Value &CharacterValue::operator-(const Value &rhs) {
45-
throw Exception::CLDENonSupportedFunctionException("operator- can not be applied to CharacterValue type");
46-
}
44+
Value &CharacterValue::operator-(const Value &rhs) {
45+
throw DataTypeException("operator- can not be applied to CharacterValue type");
46+
}
4747

48-
Value &CharacterValue::operator*(const Value &rhs) {
49-
throw Exception::CLDENonSupportedFunctionException("operator* can not be applied to CharacterValue type");
50-
}
48+
Value &CharacterValue::operator*(const Value &rhs) {
49+
throw DataTypeException("operator* can not be applied to CharacterValue type");
50+
}
5151

52-
Value &CharacterValue::operator/(const Value &rhs) {
53-
throw Exception::CLDENonSupportedFunctionException("operator/ can not be applied to CharacterValue type");
54-
}
52+
Value &CharacterValue::operator/(const Value &rhs) {
53+
throw DataTypeException("operator/ can not be applied to CharacterValue type");
54+
}
5555

56-
Value &CharacterValue::operator%(const Value &rhs) {
57-
throw Exception::CLDENonSupportedFunctionException("operator% can not be applied to CharacterValue type");
58-
}
56+
Value &CharacterValue::operator%(const Value &rhs) {
57+
throw DataTypeException("operator% can not be applied to CharacterValue type");
58+
}
5959

60-
Value &CharacterValue::operator=(bool value) {
61-
throw Exception::CLDENonSupportedFunctionException("operator can not be applied to CharacterValue type");
62-
}
60+
Value &CharacterValue::operator=(bool value) {
61+
throw DataTypeException("operator can not be applied to CharacterValue type");
62+
}
6363

64-
Value &CharacterValue::operator=(double value) {
65-
throw Exception::CLDENonSupportedFunctionException("operator can not be applied to CharacterValue type");
66-
}
64+
Value &CharacterValue::operator=(double value) {
65+
throw DataTypeException("operator can not be applied to CharacterValue type");
66+
}
6767

68-
Value &CharacterValue::operator=(float value) {
69-
throw Exception::CLDENonSupportedFunctionException("operator can not be applied to CharacterValue type");
70-
}
68+
Value &CharacterValue::operator=(float value) {
69+
throw DataTypeException("operator can not be applied to CharacterValue type");
70+
}
7171

72-
Value &CharacterValue::operator=(int16 value) {
73-
throw Exception::CLDENonSupportedFunctionException("operator can not be applied to CharacterValue type");
74-
}
72+
Value &CharacterValue::operator=(int16 value) {
73+
throw DataTypeException("operator can not be applied to CharacterValue type");
74+
}
7575

76-
Value &CharacterValue::operator=(int32 value) {
77-
throw Exception::CLDENonSupportedFunctionException("operator can not be applied to CharacterValue type");
78-
}
76+
Value &CharacterValue::operator=(int32 value) {
77+
throw DataTypeException("operator can not be applied to CharacterValue type");
78+
}
7979

80-
Value &CharacterValue::operator=(int64 value) {
81-
throw Exception::CLDENonSupportedFunctionException("operator can not be applied to CharacterValue type");
82-
}
80+
Value &CharacterValue::operator=(int64 value) {
81+
throw DataTypeException("operator can not be applied to CharacterValue type");
82+
}
8383

84-
Value &CharacterValue::operator=(uint16 value) {
85-
throw Exception::CLDENonSupportedFunctionException("operator can not be applied to CharacterValue type");
86-
}
84+
Value &CharacterValue::operator=(uint16 value) {
85+
throw DataTypeException("operator can not be applied to CharacterValue type");
86+
}
8787

88-
Value &CharacterValue::operator=(uint32 value) {
89-
throw Exception::CLDENonSupportedFunctionException("operator can not be applied to CharacterValue type");
90-
}
88+
Value &CharacterValue::operator=(uint32 value) {
89+
throw DataTypeException("operator can not be applied to CharacterValue type");
90+
}
9191

92-
Value &CharacterValue::operator=(uint64 value) {
93-
throw Exception::CLDENonSupportedFunctionException("operator can not be applied to CharacterValue type");
94-
}
92+
Value &CharacterValue::operator=(uint64 value) {
93+
throw DataTypeException("operator can not be applied to CharacterValue type");
9594
}
9695
}
9796
}

cldeplus/Data/CharacterValue.h

Lines changed: 38 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -16,51 +16,48 @@ limitations under the License.
1616
1717
*/
1818

19-
#ifndef CLOUD_E_CPLUS_FOUNDATION_TYPE_CHARACTERVALUE_H
20-
#define CLOUD_E_CPLUS_FOUNDATION_TYPE_CHARACTERVALUE_H
19+
#ifndef CLDEPLUS_DATA_CHARACTERVALUE_H
20+
#define CLDEPLUS_DATA_CHARACTERVALUE_H
2121

22-
#include "cldeNonSupportedFunctionException.h"
23-
#include "Value.h"
22+
#include "../Value.h"
2423

2524
namespace CLDEPlus {
26-
namespace Foundation {
27-
namespace Data {
28-
29-
class CharacterValue : public Value {
30-
static ValueCategory _category;
31-
32-
public:
33-
CharacterValue(ValueType dataType, size_t size);
34-
CharacterValue(const CharacterValue &) = default;
35-
CharacterValue(CharacterValue &&) = default;
36-
CharacterValue &operator=(const CharacterValue &) = default;
37-
CharacterValue &operator=(CharacterValue &&) = default;
38-
virtual ~CharacterValue() = default;
39-
40-
const ValueCategory &getCategory() const override;
41-
bool isNumeric() const override;
42-
43-
// IComputable
44-
virtual Value &operator+(const Value &rhs) override;
45-
virtual Value &operator-(const Value &rhs) override;
46-
virtual Value &operator*(const Value &rhs) override;
47-
virtual Value &operator/(const Value &rhs) override;
48-
virtual Value &operator%(const Value &rhs) override;
49-
50-
// IPrimitiveAssignable
51-
virtual Value &operator=(bool value) override;
52-
virtual Value &operator=(double value) override;
53-
virtual Value &operator=(float value) override;
54-
virtual Value &operator=(int16 value) override;
55-
virtual Value &operator=(int32 value) override;
56-
virtual Value &operator=(int64 value) override;
57-
virtual Value &operator=(uint16 value) override;
58-
virtual Value &operator=(uint32 value) override;
59-
virtual Value &operator=(uint64 value) override;
60-
};
61-
}
25+
namespace Data {
26+
27+
class CharacterValue : public Value {
28+
static ValueCategory _category;
29+
30+
public:
31+
CharacterValue(ValueType dataType, size_t size);
32+
CharacterValue(const CharacterValue &) = default;
33+
CharacterValue(CharacterValue &&) = default;
34+
CharacterValue &operator=(const CharacterValue &) = default;
35+
CharacterValue &operator=(CharacterValue &&) = default;
36+
virtual ~CharacterValue() = default;
37+
38+
const ValueCategory &getCategory() const override;
39+
bool isNumeric() const override;
40+
41+
// IComputable
42+
virtual Value &operator+(const Value &rhs) override;
43+
virtual Value &operator-(const Value &rhs) override;
44+
virtual Value &operator*(const Value &rhs) override;
45+
virtual Value &operator/(const Value &rhs) override;
46+
virtual Value &operator%(const Value &rhs) override;
47+
48+
// IPrimitiveAssignable
49+
virtual Value &operator=(bool value) override;
50+
virtual Value &operator=(double value) override;
51+
virtual Value &operator=(float value) override;
52+
virtual Value &operator=(int16 value) override;
53+
virtual Value &operator=(int32 value) override;
54+
virtual Value &operator=(int64 value) override;
55+
virtual Value &operator=(uint16 value) override;
56+
virtual Value &operator=(uint32 value) override;
57+
virtual Value &operator=(uint64 value) override;
58+
};
6259
}
6360
}
6461

6562

66-
#endif //CLOUD_E_CPLUS_FOUNDATION_TYPE_CHARACTERVALUE_H
63+
#endif //CLDEPLUS_DATA_CHARACTERVALUE_H
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,17 @@ limitations under the License.
1616
1717
*/
1818

19-
#include "Currency.h"
19+
#include "DataTypeException.h"
2020

21+
namespace CLDEPlus {
22+
namespace Data {
2123

24+
string const DataTypeException::_name{"DataTypeException"};
25+
26+
string const &DataTypeException::Name() const noexcept {
27+
return _name;
28+
}
29+
}
30+
}
2231

2332

cldeplus/Data/DataTypeException.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
3+
Copyright 2015 LE, Duc-Anh
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
17+
*/
18+
19+
#ifndef CLDEPLUS_DATA_DATATYPEEXCEPTION_H
20+
#define CLDEPLUS_DATA_DATATYPEEXCEPTION_H
21+
22+
#include "../Exception.h"
23+
24+
namespace CLDEPlus {
25+
namespace Data {
26+
27+
class DataTypeException : public Exception {
28+
29+
static string const _name;
30+
31+
public:
32+
explicit DataTypeException(char const *message) : Exception(message) { };
33+
explicit DataTypeException(string const &message) : Exception(message) {};
34+
virtual ~DataTypeException() = default;
35+
36+
// CLDEException
37+
virtual const string &Name() const noexcept override;
38+
};
39+
}
40+
}
41+
42+
#endif //CLDEPLUS_DATA_DATATYPEEXCEPTION_H

0 commit comments

Comments
 (0)