本文整理汇总了C++中sName函数的典型用法代码示例。如果您正苦于以下问题:C++ sName函数的具体用法?C++ sName怎么用?C++ sName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sName函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _log
int CNssCreature::SummonAssociate(CGameObject *oObject, char *Params) {
CNWSCreature *cre = oObject->AsNWSCreature();
if (!cre) {
_log(2, "o Error SummonAssociate used on non-creature object.\n");
sprintf(Params, "-1");
return 0;
}
uint16_t Type=0;
char Name[250];
char ResRef[16];
if (sscanf(Params, "%s %s %d", ResRef, Name, &Type) != 3) {
sprintf(Params, "-1");
return -1;
}
CResRef sResRef;
strcpy(sResRef.resref, ResRef);
CExoString sName(Name);
_log(3, "ResRef: %s\tName: %s\tType %d\n", sResRef.resref, sName.text, Type);
cre->SummonAssociate(sResRef, sName, Type);
return 1;
}
示例2: GetItem
int CItems::New(LPCTSTR szName, LPCTSTR szContent, int nParentId, BOOL bFolder, int nModuleId/* =-1*/)
{
if (bFolder == FALSE || nModuleId == -1) // new item is not folder, to get module id from parent folder
{
Assist::IItemIteratorPtr pParent = GetItem(nParentId);
nModuleId = pParent->GetModuleId();
if (nModuleId == ID_TRASH)
ThrowError(RESSTR(IDS_CAN_NOT_ADD_TO_TRASH));
}
IStatementPtr st = CApplicationImpl::Get().GetStatement();
CStringBuf sName(szName);
CStringBuf sContent(szContent);
time_t t = dateutils::GetCurrentDate();
st->sql(_T("insert into adx_items (created, name, content, module, parent, folder) values (:created, :name, :content, :module, :parent, :folder)"));
st->use(t, _T(":created"));
st->use(sName, _T(":name"));
st->use(sContent, _T(":content"));
st->use(nModuleId, _T(":module"));
st->use(nParentId, _T(":parent"));
st->use((int&)bFolder, _T(":folder"));
st->exec();
return st->last_insert_rowid();
}
示例3: THROW_STD_EXCEPTION
void Event::Create(const TCHAR* const pszName)
{
if(NULL == pszName)
THROW_STD_EXCEPTION(L"The name of the event may not be null");
CString sName(pszName);
sName.Trim();
if(0 >= sName.GetLength())
THROW_STD_EXCEPTION(L"The name of the event is invalid. It is either empty, or contains only spaces.");
m_hEvent = CreateEvent(NULL, TRUE, FALSE, sName);
if(NULL == m_hEvent)
{
DWORD dwLastError = ::GetLastError();
CString sMessage;
sMessage.Format(_T("Failed to create the event, \"%s\"."), (LPCTSTR)sName);
THROW_STD_EXCEPTION(sMessage);
}
DWORD dwLastError = GetLastError();
if(ERROR_ALREADY_EXISTS == dwLastError)
{
CloseHandle(m_hEvent);
m_hEvent = 0;
CString sMessage;
sMessage.Format(_T("Failed to create the event, \"%s\" as the event already exists."), (LPCTSTR)sName);
THROW_STD_EXCEPTION(sMessage);
}
CString sMessage;
sMessage.Format(_T("The event \"%s\" has been created."), (LPCTSTR)sName);
LOG_WS_INFO(std::wstring(sMessage).c_str());
}
示例4: switch
irr::scene::ISceneNode *CIrrOdeSceneNodeFactory::addSceneNode (irr::scene::ESCENE_NODE_TYPE type, irr::scene::ISceneNode *parent) {
CIrrOdeSceneNode *pRet=NULL;
if (!parent) parent=m_pManager->getRootSceneNode();
switch (type) {
case IRR_ODE_BODY_ID : pRet=new CIrrOdeBody (parent,m_pManager); break;
case IRR_ODE_GEOM_BOX_ID : pRet=new CIrrOdeGeomBox (parent,m_pManager); break;
case IRR_ODE_GEOM_CAPSULE_ID : pRet=new CIrrOdeGeomCapsule (parent,m_pManager); break;
case IRR_ODE_GEOM_CYLINDER_ID : pRet=new CIrrOdeGeomCylinder (parent,m_pManager); break;
case IRR_ODE_GEOM_HEIGHTFIELD_ID : pRet=new CIrrOdeGeomHeightfield(parent,m_pManager); break;
case IRR_ODE_GEOM_PLANE_ID : pRet=new CIrrOdeGeomPlane (parent,m_pManager); break;
case IRR_ODE_GEOM_RAY_ID : pRet=new CIrrOdeGeomRay (parent,m_pManager); break;
case IRR_ODE_GEOM_SPHERE_ID : pRet=new CIrrOdeGeomSphere (parent,m_pManager); break;
case IRR_ODE_GEOM_TRIMESH_ID : pRet=new CIrrOdeGeomTrimesh (parent,m_pManager); break;
case IRR_ODE_JOINT_FIXED_ID : pRet=new CIrrOdeJointFixed (parent,m_pManager); break;
case IRR_ODE_JOINT_HINGE_ID : pRet=new CIrrOdeJointHinge (parent,m_pManager); break;
case IRR_ODE_JOINT_HINGE2_ID : pRet=new CIrrOdeJointHinge2 (parent,m_pManager); break;
case IRR_ODE_JOINT_SLIDER_ID : pRet=new CIrrOdeJointSlider (parent,m_pManager); break;
case IRR_ODE_SPACE_ID : pRet=new CIrrOdeSpace (parent,m_pManager); break;
case IRR_ODE_WORLD_ID : pRet=new CIrrOdeWorld (parent,m_pManager); break;
case IRR_ODE_MOTOR_ID : pRet=new CIrrOdeMotor (parent,m_pManager); break;
case IRR_ODE_SERVO_ID : pRet=new CIrrOdeServo (parent,m_pManager); break;
case IRR_ODE_IMPULSE_MOTOR_ID : pRet=new CIrrOdeImpulseMotor (parent,m_pManager); break;
case IRR_ODE_TORQUE_MOTOR_ID : pRet=new CIrrOdeTorqueMotor (parent,m_pManager); break;
case IRR_ODE_AERO_DRAG_ID : pRet=new CIrrOdeAeroDrag (parent,m_pManager); break;
default: break;
}
#ifdef _TRACE_FACTORY
irr::core::stringc sName(pRet->getTypeName());
printf("CIrrOdeSceneNodeFactory::addSceneNode(%i): \"%s\"\n",(int)type,sName.c_str());
#endif
return pRet;
}
示例5: DMOEnum
void CSystemDeviceEnumerator::EnumerateDMOs(const IID clsidDMOCategory)
{
IEnumDMO* pEnum = NULL;
HRESULT hr = DMOEnum(
clsidDMOCategory, // Category
DMO_ENUMF_INCLUDE_KEYED, // Included keyed DMOs
0, NULL, // Input types (don't care)
0, NULL, // Output types (don't care)
&pEnum);
if (SUCCEEDED(hr))
{
CLSID clsidDMO;
WCHAR* wszName;
do
{
hr = pEnum->Next(1, &clsidDMO, &wszName, NULL);
if (hr == S_OK)
{
// Now wszName holds the friendly name of the DMO,
// and clsidDMO holds the CLSID.
CString sName(wszName);
m_listDMOs.push_back(sName);
CoTaskMemFree(wszName);
}
} while (hr == S_OK);
pEnum->Release();
}
}
示例6: sEID
void CMLogin::Login(const char* sEid, const char* sUserName, const char* sPassWord,const char* sUserId, BOOL bAutoLogin)
{
if(m_bLogin) return;
m_bLogin = TRUE;
CMGlobal::TheOne().SetOffline(FALSE);
SETTING.SetCustomer(sEid);
SETTING.SetUserName(sUserName);
SETTING.SetUserPass(sPassWord);
SETTING.SetUserId(sUserId);
SETTING.SetAutoLogin(bAutoLogin);
SETTING.Save();
CMString sEID(sEid), sName(sUserName), sPass(sPassWord), sUid(sUserId);
const char* sNewName = (const char *)sName;
if(sNewName == SETTING.GetUserName())
CMGlobal::TheOne().SetUserStatus(FALSE);
else
CMGlobal::TheOne().SetUserStatus(TRUE);
if(m_pSession == NULL)
m_pSession = new CMSession(this);
if(m_pSession)
m_pSession->LogIn(sEID, sName, sPass, sUid,FALSE, 1);
}
示例7: OnWebRequest
bool OnWebRequest(CWebSock& WebSock, const CString& sPageName,
CTemplate& Tmpl) override {
if (sPageName != "index") {
// only accept requests to index
return false;
}
if (WebSock.IsPost()) {
SetNV("username", WebSock.GetParam("username"));
CString sPassword = WebSock.GetParam("password");
if (!sPassword.empty()) {
SetNV("password", sPassword);
}
SetNV(NV_REQUIRE_AUTH, WebSock.GetParam("require_auth"));
SetNV(NV_MECHANISMS, WebSock.GetParam("mechanisms"));
}
Tmpl["Username"] = GetNV("username");
Tmpl["Password"] = GetNV("password");
Tmpl["RequireAuth"] = GetNV(NV_REQUIRE_AUTH);
Tmpl["Mechanisms"] = GetMechanismsString();
for (const auto& it : SupportedMechanisms) {
CTemplate& Row = Tmpl.AddRow("MechanismLoop");
CString sName(it.szName);
Row["Name"] = sName;
Row["Description"] = CString(it.szDescription);
}
return true;
}
示例8: sName
TYPE_File* ToppyFramework::Hdd_Fopen(char *name )
{
CString sName(name);
if ((sName.Find("/")!=-1) || (sName.Find("\\")!=-1))
{
LogError("Tried to open a file with a path in the name - %s", name);
return 0;
}
FILE* handle = fopen(MakePath(name), "rb+"); // open for update
if (handle == NULL)
{
LogError("Failed to open file %s", (LPCSTR) MakePath(name));
return 0;
}
TYPE_File* pToppyHandle = new TYPE_File();
ZeroMemory(pToppyHandle, sizeof(TYPE_File));
strncpy(pToppyHandle->name, name, 100);
m_mapOpenFiles[pToppyHandle] = handle;
pToppyHandle->size = Hdd_Flen(pToppyHandle);
LogInfo("Opened %s - handle 0x%x, TYPE_File 0x%x", (LPCSTR) MakePath(name), handle, pToppyHandle);
pToppyHandle->startCluster = GetStartClusterHash(name);
pToppyHandle->totalCluster = 0;
// TODO: more initialization?
return pToppyHandle;
}
示例9: dffi
void TestDocFileFontInfo::TestConvertUnicodeFontName()
{
RTFFileContext context;
DocFileFontinfo dffi(&context);
dffi.m_iCharSet = 0; //
CWideString sName("Fishies");
assertTest(sName == dffi.ConvertUnicodeFontName(sName));
// HG 20024 65402 65438 65404 65391 65400 M-PRO
// HG\'8a\'db\'ba\'de\'bc\'af\'b8M-PRO
sName = "HG??????m-pro";
sName[2] = 20024;
sName[3] = 65402;
sName[4] = 65438;
sName[5] = 65404;
sName[6] = 65391;
sName[7] = 65400;
CWideString sNameOut = "HG???????m-pro";
sNameOut[2] = 0x8a;
sNameOut[3] = 0xdb;
sNameOut[4] = 0xba;
sNameOut[5] = 0xde;
sNameOut[6] = 0xbc;
sNameOut[7] = 0xaf;
sNameOut[8] = 0xb8;
dffi.m_iCharSet = 128;
assertTest(dffi.ConvertUnicodeFontName(sName) == sNameOut);
}
示例10: return
ret_ CXMLLoaderActions::LoadEnable(CProgram &Program,
const DOMElement *pElement)
{
#ifdef _DEBUG_
if (!pElement)
return (PARAMETER_NULL | PARAMETER_2);
#endif
auto_xerces_str wsName("name");
auto_xerces_str sName(pElement->getAttribute(wsName));
// Check if there is the container
if (!m_pTmpContainer)
return XML_LOADER_ERROR;
// Check if there is the button identified by the attribute
CWindow *pWindow = m_pTmpContainer->GetChild(sName);
if (!pWindow || WINDOW_BUTTON != pWindow->Type())
return XML_LOADER_ERROR;
auto_xerces_str wsEnable("enable");
auto_xerces_str sEnable(pElement->getAttribute(wsEnable));
bool_ bEnble = (0 == strcmp(sEnable, "true")) ? true_v : false_v;
COptEnable *pOpt = new COptEnable(sName, bEnble);
if (false_v == Program.AddOperator(pOpt))
return XML_LOADER_ERROR;
return SUCCESS;
}
示例11: sName
void CItems::Rename(LPCTSTR szFolderName, int nId)
{
CStringBuf sName(szFolderName);
IStatementPtr st = CApplicationImpl::Get().GetStatement();
st->sql(_T("update adx_items set name = :name where id = :id"));
st->use(sName, _T(":name"));
st->use((int&)nId, _T(":id"));
st->exec();
}
示例12: sName
CVolume *CVolumes::Create(
const wxString &sCopyFrom, const wxString &_sName)
{
wxString sPath;
wxString sName(_sName);
MapVolume::iterator itrm;
CVolume *pRtn(NULL);
CVolume *pCopyFrom;
nwxString::Trim(&sName);
if(sName.IsEmpty())
{
m_sLastError = VOLUME_STRING " name has not been specified.";
}
else if(Find(sName) != NULL)
{
_SetErrorNameExists(sName);
}
else if( (pCopyFrom = Find(sCopyFrom)) == NULL )
{
m_sLastError = "Cannot create new " Volume_string " from ";
m_sLastError.Append(sCopyFrom);
m_sLastError.Append(".\nThe " Volume_string " was not found.");
wxASSERT_MSG(0,m_sLastError);
}
else if( pCopyFrom->IsLocked() && !pCopyFrom->HasLock() )
{
m_sLastError = "Cannot create new " Volume_string " from ";
m_sLastError.Append(sCopyFrom);
m_sLastError.Append("\nbecause it is locked by ");
m_sLastError.Append(pCopyFrom->GetLockUser());
wxASSERT_MSG(0,m_sLastError);
}
else if(_BuildNewPath(pCopyFrom,&sPath))
{
auto_ptr<CVolume> apRtn(new CVolume(sPath));
if(!(apRtn->IsOK() && apRtn->InitNewVolume(sName)))
{
m_sLastError =
"Could not create new " Volume_string ".\n"
"Please check space on disk drive";
}
else if((itrm = m_mapVol.insert(MapVolume::value_type(sName,apRtn.get()))) == m_mapVol.end())
{
m_sLastError =
"Could not add new " Volume_string " to the set.\n"
"System may not have sufficient memory.";
}
else
{
_SetModified();
pRtn = apRtn.release();
}
}
return pRtn;
}
示例13: sName
void icqAccount::setStatusFromPlugin(accountStatus status, const QString &status_text)
{
if ( status > -1)
{
if ((status != online) && (status != offline) && (status != ffc)
&& (status != invisible))
{
QString sName(StatusNames[static_cast<int>(status)]);
QSettings settings(QSettings::NativeFormat, QSettings::UserScope, "qutim/qutim."+m_profile_name, "icqsettings");
QSettings account_settings(QSettings::NativeFormat, QSettings::UserScope, "qutim/qutim."+m_profile_name+"/ICQ."+icqUin , "accountsettings");
if ( m_restore_status == restoreAccount )
m_restore_status_text = account_settings.value("autoreply/" + sName
+ "msg", "").toString();
account_settings.setValue("autoreply/" + sName
+ "msg", status_text.left(1000));
thisIcqProtocol->setStatus(status);
}
// Disconnecting
else
{
if (status == offline)
thisIcqProtocol->userDisconnected = true;
// Apply new status
thisIcqProtocol->setStatus(status);
}
if ( m_restore_status == restoreAccount )
m_restore_status = thisIcqProtocol->getStatus();
} else
{
QString sName(StatusNames[static_cast<int>(m_restore_status)]);
QSettings settings(QSettings::NativeFormat, QSettings::UserScope, "qutim/qutim."+m_profile_name, "icqsettings");
QSettings account_settings(QSettings::NativeFormat, QSettings::UserScope, "qutim/qutim."+m_profile_name+"/ICQ."+icqUin , "accountsettings");
m_restore_status_text = account_settings.value("autoreply/" + sName
+ "msg", "").toString();
account_settings.setValue("autoreply/" + sName
+ "msg", status_text.left(1000));
}
}
示例14: Quotes_MakeIconName
std::string Quotes_MakeIconName(const char* name)
{
assert(name);
//char szSettingName[100];
//mir_snprintf(szSettingName,SIZEOF(szSettingName),"%s_%s",QUOTES_PROTOCOL_NAME,name);
std::string sName(QUOTES_PROTOCOL_NAME);
sName += "_";
sName += name;
return sName;
}
示例15: sName
void C4ScenarioParameters::CompileFunc(StdCompiler *pComp)
{
// Unfortunately, StdCompiler cannot save std::map yet
if (pComp->isDeserializer())
{
Parameters.clear();
if (pComp->hasNaming())
{
// load from INI
size_t name_count = pComp->NameCount();
for (size_t i=0; i<name_count; ++i)
{
int32_t v=0;
const char *name = pComp->GetNameByIndex(0); // always get name index 0, because names are removed after values have been extracted for them
StdCopyStrBuf sName(name);
if (!name) continue;
pComp->Value(mkNamingAdapt(v, sName.getData(), 0));
Parameters[sName] = v;
}
}
else
{
// load from binary
int32_t name_count=0;
pComp->Value(name_count);
for (int32_t i=0; i<name_count; ++i)
{
StdCopyStrBuf name; int32_t v;
pComp->Value(name);
pComp->Value(v);
Parameters[name] = v;
}
}
}
else
{
if (pComp->hasNaming())
{
// save to INI
for (auto & Parameter : Parameters)
pComp->Value(mkNamingAdapt(Parameter.second, Parameter.first.getData()));
}
else
{
// save to binary
int32_t name_count=Parameters.size();
pComp->Value(name_count);
for (auto & Parameter : Parameters)
{
pComp->Value(const_cast<StdCopyStrBuf &>(Parameter.first));
pComp->Value(Parameter.second);
}
}
}
}