Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
kebiao committed Feb 15, 2019
1 parent fde39d1 commit d30a5da
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
12 changes: 12 additions & 0 deletions kbe/src/lib/entitydef/datatypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ DataTypes::DATATYPE_MAP DataTypes::dataTypesLowerName_;
DataTypes::UID_DATATYPE_MAP DataTypes::uid_dataTypes_;
DataTypes::DATATYPE_ORDERS DataTypes::dataTypesOrders_;

static uint8 _g_baseTypeEndIndex = 0;

//-------------------------------------------------------------------------------------
DataTypes::DataTypes()
{
Expand Down Expand Up @@ -72,9 +74,19 @@ bool DataTypes::initialize(std::string file)
addDataType("VECTOR2", new Vector2Type);
addDataType("VECTOR3", new Vector3Type);
addDataType("VECTOR4", new Vector4Type);

_g_baseTypeEndIndex = dataTypesOrders_.size();
return loadTypes(file);
}

//-------------------------------------------------------------------------------------
std::vector< std::string > DataTypes::getBaseTypeNames()
{
std::vector< std::string > ret;
ret.assign(dataTypesOrders_.begin(), dataTypesOrders_.begin() + _g_baseTypeEndIndex);
return ret;
}

//-------------------------------------------------------------------------------------
bool DataTypes::loadTypes(std::string& file)
{
Expand Down
6 changes: 4 additions & 2 deletions kbe/src/lib/entitydef/datatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ class DataTypes
static bool loadTypes(std::string& file);
static bool loadTypes(SmartPointer<XML>& xml);

static const DATATYPE_MAP& dataTypes(){ return dataTypes_; }
static const UID_DATATYPE_MAP& uid_dataTypes(){ return uid_dataTypes_; }
static const DATATYPE_MAP& dataTypes() { return dataTypes_; }
static const UID_DATATYPE_MAP& uid_dataTypes() { return uid_dataTypes_; }
static const DATATYPE_ORDERS& dataTypesOrders() { return dataTypesOrders_; }

static std::vector< std::string > getBaseTypeNames();

protected:
static DATATYPE_MAP dataTypes_;
static DATATYPE_MAP dataTypesLowerName_;
Expand Down

0 comments on commit d30a5da

Please sign in to comment.