本文整理汇总了C++中mygui::UString::substr方法的典型用法代码示例。如果您正苦于以下问题:C++ UString::substr方法的具体用法?C++ UString::substr怎么用?C++ UString::substr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mygui::UString
的用法示例。
在下文中一共展示了UString::substr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertProjectName
MyGUI::UString EditorState::convertProjectName(const MyGUI::UString& _fileName)
{
size_t pos = mFileName.find_last_of("\\/");
MyGUI::UString shortName = pos == MyGUI::UString::npos ? mFileName : mFileName.substr(pos + 1);
addUserTag("ResourceName", shortName);
size_t index = _fileName.find("|");
if (index == MyGUI::UString::npos)
return _fileName;
MyGUI::UString fileName = _fileName.substr(0, index);
MyGUI::UString itemIndexName = _fileName.substr(index + 1);
size_t itemIndex = MyGUI::utility::parseValue<size_t>(itemIndexName);
MyGUI::xml::Document doc;
if (!doc.open(fileName))
return _fileName;
MyGUI::xml::ElementPtr root = doc.getRoot();
if ((nullptr == root) || (root->getName() != "MyGUI"))
return _fileName;
if (root->findAttribute("type") == "Resource")
{
// берем детей и крутимся
MyGUI::xml::ElementEnumerator element = root->getElementEnumerator();
while (element.next("Resource"))
{
if (element->findAttribute("type") == "ResourceLayout")
{
if (itemIndex == 0)
{
// поменять на теги
std::string resourceName = element->findAttribute("name");
addUserTag("ResourceName", resourceName);
return MyGUI::utility::toString(fileName, " [", resourceName, "]");
}
else
{
itemIndex --;
}
}
}
}
return _fileName;
}
示例2: updateActorTheme
void StatePanel::updateActorTheme(const MyGUI::UString& commandName, bool& result)
{
std::string materialname = commandName.substr(commandName.find_first_of('_') + 1);
Animation * anim = getActiveAnimation();
if(anim != nullptr)
{
anim->upateActorTheme(materialname);
}
}
示例3: setModeSaveLoadDialog
void EditorState::setModeSaveLoadDialog(bool _save, const MyGUI::UString& _filename)
{
if (_save)
mOpenSaveFileDialog->setDialogInfo(localise("Save"), localise("Save"));
else
mOpenSaveFileDialog->setDialogInfo(localise("Load"), localise("Load"));
size_t pos = _filename.find_last_of(L"\\/");
if (pos == MyGUI::UString::npos)
{
mOpenSaveFileDialog->setFileName(_filename);
}
else
{
mOpenSaveFileDialog->setCurrentFolder(_filename.substr(0, pos));
mOpenSaveFileDialog->setFileName(_filename.substr(pos + 1));
}
mOpenSaveFileDialog->setVisible(true);
mModeSaveDialog = _save;
}