void nuiBorderDecoration::SetBorderMode(nglString mode) { if (!mode.Compare(_T("Normal"), false)) mBorderMode = eBorderNormal; else if (!mode.Compare(_T("3D"), false)) mBorderMode = eBorder3DIn; else if (!mode.Compare(_T("3DIn"), false)) mBorderMode = eBorder3DIn; else if (!mode.Compare(_T("3DOut"), false)) mBorderMode = eBorder3DOut; else mBorderMode = eBorderNormal; Changed(); }
bool FromString(void* pTarget, int32 index0, int32 index1, const nglString& rString) const //bool FromString(nuiAnchorType& Value, const nglString& rString) const { if (rString.Compare("Relative", false) == 0) { mSetAnchorDelegate(mAnchor, eAnchorRelative); return true; } else if (rString.Compare("Absolute", false) == 0) { mSetAnchorDelegate(mAnchor, eAnchorAbsolute); return true; } return false; }
void nglConsole::Input (nglString& rLine) { #if NGL_DISABLE_CONSOLE return; #else rLine.TrimRight(); if (mUseHExpansion && (!rLine.Compare(_T("!"), 0, 1))) { list<nglString*>::iterator h_entry; list<nglString*>::iterator h_end = mHistory.end(); nglString base = rLine.Extract (1, -1); int size = base.GetLength(); for (h_entry = mHistory.begin(); h_entry != h_end; ++h_entry) if (*h_entry) { if ((!base.Compare(_T("!"), 0, 1)) || // "!!" (repeat last) (!(*h_entry)->Compare (base, 0, size, mHistoryCase))) { NGL_OUT(_T("%s\n"), (nglChar*)(*h_entry)); OnInput (**h_entry); return; } } } OnInput (rLine); #endif }
static bool Canonize(nglString& rStr) { nglString canon; int32 len = rStr.GetLength(); int32 root_part = GetRootPart(rStr); int32 last_slash = root_part; int32 slash = 0; canon = rStr.GetLeft(root_part); while (slash < len) { slash = rStr.Find(_T('/'), last_slash); if (slash == - 1) slash = len; if (((slash - last_slash) == 1) && (rStr.GetChar(last_slash) == _T('.'))) { // Ignore '.' } else if (((slash - last_slash) == 2) && (!rStr.Compare(_T(".."), last_slash, 2))) { // Interpret '..' int32 prev_slash = canon.FindLast(_T('/')); if (prev_slash < root_part) prev_slash = root_part; if (!canon.IsEmpty() && canon.Compare(_T(".."), canon.GetLength() - 2, 2)) canon.Delete(prev_slash); else { if (canon.GetLength() > root_part) canon += _T('/'); canon += _T(".."); } } else { // Simply append path node nglString node = rStr.Extract(last_slash, (slash - last_slash)); if (canon.GetLength() > root_part) canon += _T('/'); canon += node; } last_slash = slash + 1; } rStr = canon; return true; }
bool nglImageCodecInfo::ExtensionMatch(nglString& rFileName) { std::vector<nglString>::iterator ext; int filename_len = rFileName.GetLength(); for (ext = mExtensions.begin(); ext < mExtensions.end(); ++ext) { int ext_size = (*ext).GetLength(); if (!rFileName.Compare (*ext, filename_len - ext_size, ext_size, false)) return true; } return false; }
void nuiBorderDecoration::SetBorderType(nglString type) { if (!type.Compare(_T("All"), false)) mBorderType = eBorderAll; else if (!type.Compare(_T("Left"), false)) mBorderType = eBorderLeft; else if (!type.Compare(_T("Right"), false)) mBorderType = eBorderRight; else if (!type.Compare(_T("Top"), false)) mBorderType = eBorderTop; else if (!type.Compare(_T("Bottom"), false)) mBorderType = eBorderBottom; else if (!type.Compare(_T("Horizontal"), false)) mBorderType = eBorderHorizontal; else if (!type.Compare(_T("Vertical"), false)) mBorderType = eBorderVertical; else if (!type.Compare(_T("None"), false)) mBorderType = eBorderNone; else mBorderType = eBorderNone; Changed(); }
int nglConsole::GetHistory (list<const nglString*>& rMatches, nglString& rFilter, bool IsCaseSensitive) { #if NGL_DISABLE_CONSOLE return 0; #else int count = 0; list<nglString*>::reverse_iterator h_entry; list<nglString*>::reverse_iterator h_begin = mHistory.rbegin(); rMatches.clear(); int size = rFilter.GetLength(); for (h_entry = mHistory.rend(); h_entry != h_begin; h_entry--) if (!rFilter.Compare(**h_entry, 0, size, IsCaseSensitive)) { rMatches.push_front(*h_entry); count++; } return count; #endif }
bool nglPath_SetVolume(nglPathVolume& rVolume, nglString& rMPoint, nglString& rDevice, nglString& rFSType, nglString& rOptions) { rVolume.mPath = nglPath(rMPoint); rVolume.mFlags = nglPathVolume::Offline; rVolume.mType = nglPathVolume::eTypeUnknown; if ((rMPoint == _T("none")) || (rMPoint == _T("/")) || (rMPoint == _T("/boot")) || (rMPoint == _T("/usr")) || (rMPoint == _T("/usr/local")) || (rMPoint == _T("/var")) || (rMPoint == _T("/tmp")) || (rMPoint == _T("/home"))) { rVolume.mFlags |= nglPathVolume::System; } if (!rDevice.Compare(_T("/dev/hd"), 0, 7)) { int controler = (rDevice[7] - 'a') / 2 + 1; int channel = (rDevice[7] - 'a') % 2; int partition = rDevice[8] - '0'; rVolume.mComment.Format(_T("%s on %d%s partition (%s on %d%s IDE controler)"), rFSType.GetChars(), partition, _intrank(partition), channel ? _T("slave") : _T("master"), controler, _intrank(controler)); } else if (!rDevice.Compare(_T("/dev/sd"), 0, 7)) { int dev = rDevice[7] - 'a'; int partition = rDevice[8] - '0'; rVolume.mComment.Format(_T("%s on %d%s partition (%d%s SCSI device)"), rFSType.GetChars(), partition, _intrank(partition), dev, _intrank(dev)); rVolume.mType = nglPathVolume::eTypeHD; } else if ((!rDevice.Compare(_T("/dev/sr"), 0, 7)) || (!rDevice.Compare(_T("/dev/sg"), 0, 7))) { int dev = rDevice[7] - '0' + 1; rVolume.mComment.Format(_T("%s (%d%s SCSI device)"), rFSType.GetChars(), dev, _intrank(dev)); rVolume.mFlags |= nglPathVolume::Removable; rVolume.mType = nglPathVolume::eTypeCD; } else if (!rDevice.Compare(_T("/dev/fd"), 0, 7)) { int dev = rDevice[7] - '0' + 1; rVolume.mComment.Format(_T("%d%s floppy"), dev, _intrank(dev)); rVolume.mFlags |= nglPathVolume::Removable; rVolume.mType = nglPathVolume::eTypeFloppy; } if (rFSType == _T("smbfs")) { rVolume.mComment.Format(_T("%s (SMB)"), rDevice.GetChars()); rVolume.mType = nglPathVolume::eTypeNetwork; } else if (rFSType == _T("nfs")) { rVolume.mComment.Format(_T("%s (NFS)"), rDevice.GetChars()); rVolume.mType = nglPathVolume::eTypeNetwork; } else if ((rFSType == _T("proc")) || (rFSType == _T("devfs")) || (rFSType == _T("usbdevfs")) || (rFSType == _T("devpts"))) { rVolume.mComment = rFSType; rVolume.mFlags |= nglPathVolume::System; } if (nglPath_IsRO(rOptions)) rVolume.mFlags |= nglPathVolume::ReadOnly; return true; }