382 lines
10 KiB
C++
382 lines
10 KiB
C++
|
#pragma execution_character_set("utf-8")
|
|||
|
|
|||
|
#include "DataAttribute.h"
|
|||
|
#include "M_NormalColumnDAO.h"
|
|||
|
#include "M_EntityModelDAO.h"
|
|||
|
#include "global.h"
|
|||
|
#include "DataClass.h"
|
|||
|
#include "DataManager.h"
|
|||
|
#include < regex >
|
|||
|
|
|||
|
DataAttribute::DataAttribute()
|
|||
|
{
|
|||
|
_baseType = g_TYPE_DATAATTRUBUTE;
|
|||
|
}
|
|||
|
|
|||
|
DataAttribute::~DataAttribute()
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void static backupDAOData(DBPlatformSpace::M_NormalColumnDAO& src, DBPlatformSpace::M_NormalColumnDAO& dst)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void static restoreData(DBPlatformSpace::M_NormalColumnDAO& src, DataAttribute& dst)
|
|||
|
{
|
|||
|
//<2F><>Ҫ<EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
}
|
|||
|
|
|||
|
void DataAttribute::checkImportAttributeName(DPData* pParent)
|
|||
|
{
|
|||
|
DataClass* pClass = qobject_cast<DataClass*>(pParent);
|
|||
|
|
|||
|
/*<2A>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
int id = 0;
|
|||
|
QString newName = _strDisplayName;
|
|||
|
while (pClass->hasSameNameChild("displayName", newName))
|
|||
|
{
|
|||
|
LOG(INFO) << CommonHelper::utf8ToStdString("<EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|||
|
id += 1;
|
|||
|
newName = _strDisplayName + QString::number(id);
|
|||
|
}
|
|||
|
_strDisplayName = newName;
|
|||
|
}
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8>дC,<2C>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8>д
|
|||
|
void DataAttribute::reName( )
|
|||
|
{
|
|||
|
QString oldName = _name;
|
|||
|
QString newName;
|
|||
|
//<2F><><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD>ɴ<EFBFBD>д
|
|||
|
if (oldName.at(0) == "C" || oldName.at(0) == "c")
|
|||
|
{
|
|||
|
if (oldName.size() >= 2)
|
|||
|
{
|
|||
|
_name = 'C' + oldName.at(1).toUpper() + oldName.right(oldName.size() - 2);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_name = 'C' ;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
newName = oldName.at(0).toUpper() + oldName.right(oldName.size() - 1);
|
|||
|
_name = "C" + newName;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void DataAttribute::toJson(json& jsonObj, bool)
|
|||
|
{
|
|||
|
jsonObj["id"] = _id;
|
|||
|
jsonObj["label"] = CommonHelper::qstringToUtf8(_strDisplayName);
|
|||
|
jsonObj["name"] = CommonHelper::qstringToUtf8(_name);
|
|||
|
jsonObj["description"] = CommonHelper::qstringToUtf8(_strDescription);
|
|||
|
jsonObj["createVersion"] = _wCreateVersion;
|
|||
|
jsonObj["delVersion"] = _wDeleteVersion;
|
|||
|
jsonObj["dataType"] = _wDataType;
|
|||
|
|
|||
|
jsonObj["defaultValue"] = CommonHelper::qstringToUtf8(_strDefaultValue);
|
|||
|
jsonObj["isIndex"] = CommonHelper::intTobool(_wIsIndex);
|
|||
|
jsonObj["isOnly"] = CommonHelper::intTobool(_wIsOnly);
|
|||
|
jsonObj["isAutoincrement"] = CommonHelper::intTobool(_wIsAutoincrement);
|
|||
|
jsonObj["maxLength"] = _wMaxLength;
|
|||
|
jsonObj["minLength"] = _wMinLength;
|
|||
|
jsonObj["numLength"] = _wNumLength;
|
|||
|
jsonObj["numPresision"] = _wNumPresision;
|
|||
|
jsonObj["isFindKey"] = CommonHelper::intTobool(_wIsFindKey);
|
|||
|
jsonObj["fkType"] = _FKType;
|
|||
|
jsonObj["fkTableID"] = _wFkTableID;
|
|||
|
jsonObj["classType"] = g_TYPE_DATAATTRUBUTE;
|
|||
|
jsonObj["innerName"] = CommonHelper::qstringToUtf8(_strInternalName);
|
|||
|
//<2F>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
|
|||
|
jsonObj["isPk"] = CommonHelper::intTobool(_isPrimaryKey);
|
|||
|
|
|||
|
if (_displayfield == "")
|
|||
|
{
|
|||
|
using namespace DBPlatformSpace;
|
|||
|
|
|||
|
M_NormalColumnDAO* pAtt = static_cast<M_NormalColumnDAO*>(_pDBDAO);
|
|||
|
string name = pAtt->NameToDAOAttriName(pAtt->_name);
|
|||
|
_displayfield = QString::fromStdString(name);
|
|||
|
}
|
|||
|
|
|||
|
//[20230914]
|
|||
|
jsonObj["field"] = CommonHelper::qstringToUtf8(_displayfield);
|
|||
|
}
|
|||
|
|
|||
|
bool DataAttribute::saveSelf()
|
|||
|
{
|
|||
|
using namespace DBPlatformSpace;
|
|||
|
ResultMsg rm;
|
|||
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>*/
|
|||
|
M_NormalColumnDAO* pDao = dynamic_cast<M_NormalColumnDAO*>(_pDBDAO);
|
|||
|
/*<2A><><EFBFBD><EFBFBD>DAO<41><4F><EFBFBD><EFBFBD>*/
|
|||
|
M_NormalColumnDAO oldDaoData;
|
|||
|
backupDAOData(*pDao, oldDaoData);
|
|||
|
if (pDao == nullptr)
|
|||
|
{
|
|||
|
pDao = new M_NormalColumnDAO();
|
|||
|
}
|
|||
|
saveToDao();
|
|||
|
rm = pDao->save();
|
|||
|
if (rm.rCode == 0)
|
|||
|
{
|
|||
|
LOG(INFO) << CommonHelper::utf8ToStdString("M_NormalColumnDAO.save success ");
|
|||
|
return true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
LOG(INFO) << CommonHelper::utf8ToStdString("M_NormalColumnDAO.save failed ");
|
|||
|
LOG(ERROR) << rm.rMsg;
|
|||
|
restoreData(oldDaoData, *this);
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
bool DataAttribute::deleteSelf()
|
|||
|
{
|
|||
|
using namespace DBPlatformSpace;
|
|||
|
if (_pDBDAO)
|
|||
|
{
|
|||
|
DPData* pDataModel = getDataModelOwner();
|
|||
|
M_EntityModelDAO* pModelDAO = dynamic_cast<M_EntityModelDAO*>(pDataModel->_pDBDAO);
|
|||
|
M_NormalColumnDAO* pAttributeDao = dynamic_cast<M_NormalColumnDAO*>(_pDBDAO);
|
|||
|
ResultMsg rm = pAttributeDao->delFromEntityModel(pModelDAO);
|
|||
|
if (rm.rCode == 0)
|
|||
|
{
|
|||
|
LOG(INFO) << CommonHelper::utf8ToStdString("M_NormalColumnDAO.delFromEntityModel success ");
|
|||
|
QString msg = "NormalColumn:" + QString::number(_id) + "--" + _name + "ɾ<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>";
|
|||
|
LOG(INFO) << CommonHelper::qstringToString(msg);
|
|||
|
if (_parent)
|
|||
|
{
|
|||
|
_parent->deleteChild(_id);
|
|||
|
return true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
LOG(INFO) << CommonHelper::utf8ToStdString("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>_parent = null");
|
|||
|
//_parentΪ<74><CEAA>
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
LOG(INFO) << CommonHelper::utf8ToStdString("M_NormalColumnDAO.delFromEntityModel failed ");
|
|||
|
LOG(ERROR) << rm.rMsg;
|
|||
|
//<2F><><EFBFBD>ݿ<EFBFBD>ɾ<EFBFBD><C9BE>ʧ<EFBFBD><CAA7>
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
LOG(ERROR) << CommonHelper::utf8ToStdString("DataAttribute._pDBDAO = null ");
|
|||
|
//_pDBDAOΪ<4F><CEAA>
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void DataAttribute::loadData(DBPlatformSpace::DAO* pDao)
|
|||
|
{
|
|||
|
_pDBDAO = pDao;
|
|||
|
DBPlatformSpace::M_NormalColumnDAO* pDAOData = dynamic_cast<DBPlatformSpace::M_NormalColumnDAO*>(_pDBDAO);
|
|||
|
|
|||
|
_id = pDAOData->_ID;
|
|||
|
_name = CommonHelper::stringToQstring(pDAOData->_name);
|
|||
|
_wCreateVersion = pDAOData->_addVersion;
|
|||
|
_wDataType = pDAOData->_dataType;
|
|||
|
|
|||
|
_strDefaultValue = CommonHelper::stringToQstring(pDAOData->_defaultValue);
|
|||
|
_wDeleteVersion = pDAOData->_delVersion;
|
|||
|
_strDescription = CommonHelper::stringToQstring(pDAOData->_description);
|
|||
|
_strDisplayName = CommonHelper::stringToQstring(pDAOData->_displayName);
|
|||
|
_wFkTableID = pDAOData->_fkTableID;
|
|||
|
_FKType = pDAOData->_fkType;
|
|||
|
_strInternalName = CommonHelper::stringToQstring(pDAOData->_innerName);
|
|||
|
// int _interfaceAttrTyp; ///<<3C>ӿ<EFBFBD><D3BF><EFBFBD><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>ר<EFBFBD><D7A8><EFBFBD>ӿڵ<D3BF><DAB5><EFBFBD><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
_wIsAutoincrement = pDAOData->_isAutoIncrement;
|
|||
|
// _isDeleted <20>Ƿ<EFBFBD><C7B7><EFBFBD>ɾ<EFBFBD><C9BE>
|
|||
|
_wIsFindKey = pDAOData->_isFindKey;
|
|||
|
_wIsIndex = pDAOData->_isIndex;
|
|||
|
_wIsOnly = pDAOData->_isOnly;
|
|||
|
_wMaxLength = pDAOData->_maxLength;
|
|||
|
_wMinLength = pDAOData->_minLength;
|
|||
|
_wNumLength = pDAOData->_numLength;
|
|||
|
_wNumPresision = pDAOData->_numPresision;
|
|||
|
_isPrimaryKey = pDAOData->_isPk;
|
|||
|
//_t_M_EntityTableID <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>id
|
|||
|
}
|
|||
|
|
|||
|
void DataAttribute::saveToDao()
|
|||
|
{
|
|||
|
using namespace DBPlatformSpace;
|
|||
|
M_NormalColumnDAO* pDao = dynamic_cast<M_NormalColumnDAO*>(_pDBDAO);
|
|||
|
|
|||
|
if (pDao == nullptr)
|
|||
|
{
|
|||
|
pDao = new M_NormalColumnDAO();
|
|||
|
_pDBDAO = pDao;
|
|||
|
}
|
|||
|
|
|||
|
// pDao->_ID = getID();
|
|||
|
//<2F><><EFBFBD>Ʊ<EFBFBD>ʶ
|
|||
|
pDao->_name = CommonHelper::qstringToStdString(getName());
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
pDao->_dataType = _wDataType;
|
|||
|
|
|||
|
pDao->_fkTableID = _wFkTableID;
|
|||
|
pDao->_fkType = _FKType;
|
|||
|
|
|||
|
//Ĭ<><C4AC>ֵ
|
|||
|
pDao->_defaultValue = CommonHelper::qstringToStdString(_strDefaultValue);
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
pDao->_description = CommonHelper::qstringToStdString(_strDescription);
|
|||
|
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|||
|
pDao->_displayName = CommonHelper::qstringToStdString(_strDisplayName);
|
|||
|
//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
pDao->_isIndex = _wIsIndex;
|
|||
|
//<2F>Ƿ<EFBFBD>Ψһ
|
|||
|
pDao->_isOnly = _wIsOnly;
|
|||
|
//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
pDao->_isAutoIncrement = _wIsAutoincrement;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
pDao->_maxLength = _wMaxLength;
|
|||
|
//<2F><>С<EFBFBD><D0A1><EFBFBD><EFBFBD>
|
|||
|
pDao->_minLength = _wMinLength;
|
|||
|
//<2F><>ֵλ<D6B5><CEBB>
|
|||
|
pDao->_numLength = _wNumLength;
|
|||
|
//<2F><>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
|||
|
pDao->_numPresision = _wNumPresision;
|
|||
|
//<2F>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
pDao->_isFindKey = _wIsFindKey;
|
|||
|
//<2F>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
|
|||
|
pDao->_isPk = _isPrimaryKey;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//<2F><><EFBFBD>Ʊ<EFBFBD>ʶ<EFBFBD>Ƿ<EFBFBD><C7B7>Ϸ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD>true
|
|||
|
bool DataAttribute::illegalName( QString& errMsg)
|
|||
|
{
|
|||
|
//CR<43><52>ͷ<EFBFBD><CDB7>ID<49><44>β<EFBFBD><CEB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|||
|
if (_name.left(2) =="CR" && _name.right(2) == "ID" && _name.size() > 4)
|
|||
|
{
|
|||
|
errMsg = "<EFBFBD><EFBFBD>(<28>淶<EFBFBD><E6B7B6><EFBFBD><EFBFBD>)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD><C2B6><EFBFBD>: " + _name;
|
|||
|
return true;
|
|||
|
}
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
void DataAttribute::getNewProperty(json& parameter, QVariantMap& valueMap)
|
|||
|
{
|
|||
|
auto data = parameter["data"];
|
|||
|
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|||
|
valueMap.insert("displayName", CommonHelper::utf8ToQString(data["label"]));
|
|||
|
//<2F><><EFBFBD>Ʊ<EFBFBD>ʶ
|
|||
|
if (!data["name"].is_null())
|
|||
|
{
|
|||
|
valueMap.insert("name", CommonHelper::utf8ToQString(data["name"]));
|
|||
|
}
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
valueMap.insert("description", CommonHelper::utf8ToQString(data["description"]));
|
|||
|
//Ĭ<><C4AC>ֵ
|
|||
|
valueMap.insert("defaultValue", CommonHelper::utf8ToQString(data["defaultValue"]));
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if (!data["dataType"].is_null())
|
|||
|
{
|
|||
|
valueMap.insert("dataType", (int)data["dataType"]);
|
|||
|
}
|
|||
|
|
|||
|
//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
valueMap.insert("isIndex", (int)data["isIndex"]);
|
|||
|
//<2F>Ƿ<EFBFBD>Ψһ
|
|||
|
valueMap.insert("isOnly", (int)data["isOnly"]);
|
|||
|
//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if (!data["isAutoincrement"].is_null())
|
|||
|
{
|
|||
|
valueMap.insert("isAutoIncrement", (int)data["isAutoincrement"]);
|
|||
|
}
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
valueMap.insert("maxLen", (int)data["maxLength"]);
|
|||
|
//<2F><>С<EFBFBD><D0A1><EFBFBD><EFBFBD>
|
|||
|
valueMap.insert("minLen", (int)data["minLength"]);
|
|||
|
//<2F><>ֵλ<D6B5><CEBB>
|
|||
|
valueMap.insert("numLen", (int)data["numLength"]);
|
|||
|
//<2F><>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
|||
|
valueMap.insert("numPresision", (int)data["numPresision"]);
|
|||
|
//<2F>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
valueMap.insert("isFindKey", (int)data["isFindKey"]);
|
|||
|
//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
valueMap.insert("isPK", (int)data["isPk"]);
|
|||
|
}
|
|||
|
|
|||
|
void DataAttribute::setNewData(json& parameter)
|
|||
|
{
|
|||
|
QVariantMap newValues;
|
|||
|
getNewProperty(parameter, newValues);
|
|||
|
setProperties(newValues);
|
|||
|
}
|
|||
|
|
|||
|
void DataAttribute::setFileData(FileGenerate* generator, QStringList flag)
|
|||
|
{
|
|||
|
|
|||
|
if (flag.size() == 2)
|
|||
|
{
|
|||
|
generator->AttTableData.append(new CCS_Report::CCSModelDataSet(flag[0], flag[1], _strDisplayName, _strInternalName, CommonHelper::convertAttributeTypeTpString(_wDataType)));
|
|||
|
|
|||
|
}
|
|||
|
else if (flag.size() == 3)
|
|||
|
{
|
|||
|
generator->AttTableData111.append(new CCS_Report::CCSModelDataSet(flag[0], flag[1], flag[2], _strDisplayName, _strInternalName, CommonHelper::convertAttributeTypeTpString(_wDataType)));
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//<2F>Ϸ<EFBFBD> true. <20><><EFBFBD>Ϸ<EFBFBD> false
|
|||
|
bool DataAttribute::checkNameSize(int min, int max, QString& errMsg)
|
|||
|
{
|
|||
|
if (_name.size() >= min && _name.size() <= max)
|
|||
|
{
|
|||
|
return true;
|
|||
|
}
|
|||
|
errMsg = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ<EFBFBD>ʶ<EFBFBD><EFBFBD><EFBFBD>Ȳ<EFBFBD><EFBFBD>Ϸ<EFBFBD>:" + _name;
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
//<2F>жϵ<D0B6>index+1λ <20>Dz<EFBFBD><C7B2><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>true, <20><EFBFBD>false
|
|||
|
bool DataAttribute::checkLetter(QString& errmsg, int index)
|
|||
|
{
|
|||
|
if (_name.at(index).isLetter())
|
|||
|
{
|
|||
|
return true;
|
|||
|
}
|
|||
|
errmsg = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ<EFBFBD>ʶ<EFBFBD><EFBFBD>" + QString::number(index + 1) + "λ<EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>ĸ:" +_name;
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
//<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD>, ȫ<><C8AB>Ϊ<EFBFBD>Ϸ<EFBFBD><CFB7>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>true,
|
|||
|
bool DataAttribute::checkNameillegal(QString& errMsg)
|
|||
|
{
|
|||
|
bool foundmatch = false;
|
|||
|
try {
|
|||
|
std::regex re(R"(^[\w\(\)\[\]\<EFBFBD><EFBFBD>\<EFBFBD><EFBFBD>]+$)");
|
|||
|
foundmatch = std::regex_search(_name.toStdString(), re);
|
|||
|
}
|
|||
|
catch (std::regex_error& e) {
|
|||
|
// Syntax error in the regular expression
|
|||
|
}
|
|||
|
if (foundmatch)
|
|||
|
{//<2F>Ϸ<EFBFBD>
|
|||
|
return true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
errMsg = "<EFBFBD><EFBFBD><EFBFBD>Ʊ<EFBFBD>ʶ " + _name + " <20><><EFBFBD><EFBFBD>Ч<EFBFBD>ַ<EFBFBD>";
|
|||
|
return false;
|
|||
|
}
|
|||
|
return true; //<2F>Ϸ<EFBFBD>
|
|||
|
}
|