本文整理汇总了C++中nglString类的典型用法代码示例。如果您正苦于以下问题:C++ nglString类的具体用法?C++ nglString怎么用?C++ nglString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了nglString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Format
//*********************************************************************
//
// Format. virtual
//
//
bool nuiFormater::Format (double dValue, nglString& rResult) const
{
// identity (default formater)
rResult.CFormat ("%.0f", dValue); // i.e., 45.80
return true;
}
示例2: if
nuiAttribute<nuiAnchorType>(const nglString& rName, nuiLayout* pLayout)
: nuiAttribute<int32>(rName, nuiUnitNone, nuiMakeDelegate(this, &nuiAttribute<nuiAnchorType>::_Get), nuiMakeDelegate(this, &nuiAttribute<nuiAnchorType>::_Set), NUI_INVALID_RANGE),
mAnchor(rName.Extract(13))
{
nuiAttributeBase::SetAsInstanceAttribute(true);
if (rName.CompareLeft("HAnchorsType_", true) == 0)
{
mGetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::GetHorizontalAnchorType);
mSetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::SetHorizontalAnchorType);
}
else if (rName.CompareLeft("VAnchorsType_", true) == 0)
{
mGetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::GetVerticalAnchorType);
mSetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::SetVerticalAnchorType);
}
}
示例3: GetStatusReport
void nuiSocket::GetStatusReport(nglString& rResult)
{
nglCriticalSectionGuard g(gmCS);
rResult.Wipe();
rResult.Add("Total sockets created in session: ").Add(gmSocketCount).AddNewLine();
rResult.Add("Total current sockets...........: ").Add((int64)gmAllSockets.size()).AddNewLine();
rResult.AddNewLine();
for (std::set<nuiSocket*>::const_iterator it = gmAllSockets.begin(); it != gmAllSockets.end(); ++it)
{
nuiSocket* pSocket = *it;
rResult.Add("\t").Add(pSocket->GetDesc()).AddNewLine();
}
}
示例4: LayoutAnchorValue
LayoutAnchorValue(const nglString& rName, nuiLayout* pLayout)
: nuiAttribute<float>(rName, nuiUnitNone, nuiMakeDelegate(this, &LayoutAnchorValue::_Get), nuiMakeDelegate(this, &LayoutAnchorValue::_Set), NUI_INVALID_RANGE),
mAnchor(rName.Extract(9))
{
nuiAttributeBase::SetAsInstanceAttribute(true);
if (rName.CompareLeft("HAnchors_", true) == 0)
{
mGetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::GetHorizontalAnchorPosition);
mSetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::SetHorizontalAnchorPosition);
}
else if (rName.CompareLeft("VAnchors_", true) == 0)
{
mGetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::GetVerticalAnchorPosition);
mSetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::SetVerticalAnchorPosition);
}
}
示例5: nuiFileSelectorBase
nuiFileTree::nuiFileTree(const nglPath& rPath, const nglPath& rRootPath, const nglString& rFilter, bool showHiddenFiles)
: nuiFileSelectorBase(), mEventSink(this)
{
std::list<nglString> filters;
if (!rFilter.IsNull())
filters.push_back(rFilter);
Init(rPath, rRootPath, filters, showHiddenFiles);
}
示例6: SetState
void nuiStateDecoration::SetState(nuiStateDescription State, const nglString& rDecorationName)
{
if (rDecorationName.IsNull())
return;
nuiDecoration* pDecoration = nuiDecoration::Get(rDecorationName, true);
if (!pDecoration)
return;
SetState(State, pDecoration);
}
示例7: MsgError
bool ProjectGenerator::MsgError(const nglString& error)
{
nglString msg;
msg.Format(_T("error %ls"), error.GetChars());
NGL_OUT(msg);
nuiMessageBox* pMessageBox = new nuiMessageBox(GetMainWindow(), _T("Project Creator"), msg, eMB_OK);
pMessageBox->QueryUser();
return false;
}
示例8: nuiLabel
nuiHyperLink::nuiHyperLink(const nglString& rURL, const nglString& rLabel)
: nuiLabel(rLabel.IsNull() ? rURL : rLabel),
mURL(rURL)
{
if (SetObjectClass(_T("nuiHyperLink")))
InitAttributes();
SetTextColor(nuiColor(_T("nuiHyperLink")));
}
示例9: GetRootPart
// Stolen from nglPath!
static int32 GetRootPart(const nglString& rStr)
{
if (rStr[0] == _T('/'))
{
if (rStr[1] != _T('/'))
return 1;
// //host[/path] (network address)
// or /volume[/path] (standard unix like path)
int32 end = rStr.Find(_T('/'), 2);
return ((end > 0) ? end : rStr.GetLength());
}
// Find the protocol name:
int col = rStr.Find(_T("://"), 0, true);
return MIN(col + 3, rStr.GetLength());
}
示例10: AddFile
bool nuiZipWriter::AddFile(nglIStream* pStream, const nglString& rPathInZip, const nglString& rComment, bool OwnStream)
{
NGL_ASSERT(IsValid());
zip_fileinfo info;
nglTime tm;
nglTimeInfo t;
tm.GetLocalTime(t);
info.tmz_date.tm_sec = t.Seconds;
info.tmz_date.tm_min = t.Minutes;
info.tmz_date.tm_hour = t.Hours;
info.tmz_date.tm_mday = t.Day;
info.tmz_date.tm_mon = t.Month;
info.tmz_date.tm_year = t.Year;
info.dosDate = 0;
info.internal_fa = 0;
info.external_fa = 0;
bool res = zipOpenNewFileInZip(mpZip, rPathInZip.IsNull() ? NULL : rPathInZip.GetStdString().c_str(), &info, NULL, 0, NULL, 0, rComment.IsNull() ? NULL : rComment.GetStdString().c_str(), 0, 0) == Z_OK;
if (!res)
return res;
const uint32 bufsize = 4096;
uint8 buf[bufsize];
uint64 todo = pStream->Available();
uint32 _read = -1;
while (todo && _read)
{
uint32 toread = MIN(todo, bufsize);
_read = pStream->Read(buf, toread, 1);
res = zipWriteInFileInZip(mpZip, buf, _read) == Z_OK;
todo -= _read;
if (_read != toread)
return false;
}
res = zipCloseFileInZip(mpZip) == Z_OK;
if (OwnStream)
delete pStream;
return res;
}
示例11: nuiAudioDevice
nuiAudioDevice_DirectSound::nuiAudioDevice_DirectSound(GUID IGuid, GUID OGuid, const nglString& rInName, const nglString& rOutName, const nglString& rInModule, const nglString& rOutModule)
: nuiAudioDevice()
{
mInName = rInName;
mOutName = rOutName;
if (rOutName.IsEmpty())
mName = rInName;
else
mName = rOutName;
mManufacturer = rOutModule;
mIsPresent = false;
mHasInput = false;
mHasOutput = false;
mIDeviceID = IGuid;
mODeviceID = OGuid;
mpDirectSound = NULL;
mpDirectSoundCapture = NULL;
mAPIName = API_NAME;
mpRingBuffer = NULL;
mpInputBuffer = NULL;
mpOutputBuffer = NULL;
mpProcessingTh = NULL;
mpOutputTh = NULL;
mNotifInputEvent[0] = NULL;
mNotifInputEvent[1] = NULL;
mNotifOutputEvent[0] = NULL;
mNotifOutputEvent[1] = NULL;
HRESULT hr;
// Get Input device caps:
hr = DirectSoundCaptureCreate(&mIDeviceID, &mpDirectSoundCapture, NULL);
if (hr != S_OK || !mpDirectSoundCapture)
{
NGL_LOG(_T("nuiAudioDevice_DirectSound"), NGL_LOG_INFO, _T("constructor ERROR : could not create DirectSoundCapture object!\n"));
}
// Get Output device caps:
hr = DirectSoundCreate(&mODeviceID, &mpDirectSound, NULL);
if (hr != S_OK || !mpDirectSound)
{
NGL_LOG(_T("nuiAudioDevice_DirectSound"), NGL_LOG_ERROR, _T("constructor ERROR : could not create DirectSound object!\n")); // if there is no output, consider the device as not valid
return;
}
Init();
}
示例12: nuiDecoration
nuiStateDecoration::nuiStateDecoration(const nglString& rName, const nglString& rUp, const nglString& rDown, const nglString& rHoverOn, const nglString& rDisabled, const nglString& rDisabledSelected)
: nuiDecoration(rName), mClientRect(0,0,0,0), mUseSourceClientRect(false)
{
if (SetObjectClass(_T("nuiStateDecoration")))
InitAttributes();
if (!rUp.IsNull())
SetState(nuiStateEnabled | nuiStateReleased, GetDecoration(rUp));
if (!rDown.IsNull())
SetState(nuiStateEnabled | nuiStatePressed, GetDecoration(rDown));
if (!rHoverOn.IsNull())
SetState(nuiStateEnabled | nuiStateHoverOn, GetDecoration(rHoverOn));
if (!rDisabled.IsNull())
SetState(nuiStateDisabled | nuiStateReleased, GetDecoration(rDisabled));
if (!rDisabledSelected.IsNull())
{
SetState(nuiStateDisabled | nuiStateSelected, GetDecoration(rDisabledSelected));
SetState(nuiStateDisabled | nuiStatePressed, GetDecoration(rDisabledSelected));
}
}
示例13: Append
void nglConsole::OnOutput(const nglString& rText)
{
// 'char' mode : string buffer is considered to use the locale's encoding
Append(rText.GetChars());
// Write to the standard win32 console:
#ifdef USE_STANDARD_WIN32_CONSOLE
unsigned long res = 0;
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),rText.GetChars(),rText.GetLength(),&res,NULL);
#endif
// I don't care if this is slow, its really mandatory in win32.
vector<nglString> vec;
uint ret=rText.Tokenize(vec, _T('\n'));
for (uint i=0; i<ret; i++)
{
OutputDebugString(vec[i].GetChars()); // fixme! to be removed ?
OutputDebugString(_T("\n"));
}
}
示例14: nglPath_IsRO
bool nglPath_IsRO(nglString& rOptions)
{
std::vector<nglString> tokens;
std::vector<nglString>::iterator i;
rOptions.Tokenize(tokens, _T(','));
for (i = tokens.begin(); i != tokens.end(); i++)
if ((*i) == _T("ro")) return true;
return false;
}
示例15: DumpIncluder
void Generator::DumpIncluder(const nglPath& rootSource, const nglPath& pngSource,const nglPath& codeSource, const nglPath& HincluderPath, const nglPath& CPPincluderPath, nglString& HincluderStr, nglString& CPPincluderStr)
{
std::list<nglPath> children;
std::list<nglPath>::iterator it;
pngSource.GetChildren(&children);
for (it = children.begin(); it != children.end(); ++it)
{
nglPath child = *it;
if (!child.IsLeaf())
{
// recurs.
DumpIncluder(rootSource, child, codeSource, HincluderPath, CPPincluderPath, HincluderStr, CPPincluderStr);
continue;
}
if (child.GetExtension().Compare(_T("png"), false))
continue;
nglString node = child.GetPathName();
node.DeleteLeft(rootSource.GetPathName().GetLength()+1);
node.DeleteRight(nglPath(node).GetExtension().GetLength() +1);
nglPath HdestPath = codeSource + nglPath(node);
nglPath CPPdestPath = codeSource + nglPath(node);
HdestPath = nglPath(HdestPath.GetPathName() + _T(".h"));
CPPdestPath = nglPath(CPPdestPath.GetPathName() + _T(".cpp"));
HdestPath.MakeRelativeTo(HincluderPath.GetParent());
CPPdestPath.MakeRelativeTo(CPPincluderPath.GetParent());
nglString tmp;
tmp.Format(_T("#include \"%ls\"\n"), HdestPath.GetChars());
HincluderStr.Append(tmp);
tmp.Format(_T("#include \"%ls\"\n"), CPPdestPath.GetChars());
CPPincluderStr.Append(tmp);
}
}