本文整理汇总了C++中FSString类的典型用法代码示例。如果您正苦于以下问题:C++ FSString类的具体用法?C++ FSString怎么用?C++ FSString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FSString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParzeLink
bool ParzeLink( FSPath& path, FSString& link )
{
FSPath t( link );
if ( !path.IsAbsolute() && !t.IsAbsolute() ) { return false; } //не абсолютный путь
int first = 0;
if ( t.IsAbsolute() )
{
path.Clear();
path.PushStr( FSString( "" ) );
first = 1;
}
for ( int i = first; i < t.Count(); i++ )
{
FSString p = *( t.GetItem( i ) );
if ( p.IsDot() ) { continue; }
if ( p.Is2Dot() )
{
if ( path.Count() > 1 ) { path.Pop(); }
}
else
{
path.PushStr( p );
}
}
return true;
}
示例2: FSGetApplPath
bool FSGetApplPath(FSString &applPath, bool withPS/* = true*/)
{
#if defined(WIN32) || defined(_WIN32_WCE)
char Temp[_MAX_PATH+1];
::GetModuleFileNameA(NULL, Temp, _MAX_PATH);
applPath = Temp;
STRIndex_t pos = applPath.FindRAt(PATH_SEPARATOR_CHAR);
if ( STRING_FOUND(pos) )
applPath.Truncate( withPS ? pos + 1 : pos );
return true;
#else
UniString uniString;
if ( FSGetApplPath(uniString, withPS) )
{
applPath = uniString;
}
return false;
#endif
}
示例3: ArchGetParentDir
FSArchNode* ArchGetParentDir( FSArchNode* CurrDir, FSPath& ItemPath, const FSStat& ItemStat )
{
for ( int i = 0; i < ItemPath.Count() - 1; i++ )
{
FSString* Name = ItemPath.GetItem( i );
if ( i == 0 && ( Name->IsDot() || Name->IsEmpty() ) )
{
// skip root dir
continue;
}
FSArchNode* Dir = CurrDir->findByName( *Name );
if ( Dir == nullptr )
{
FSStat Stat = ItemStat;
Stat.mode = S_IFDIR;
Stat.size = 0;
Dir = CurrDir->Add( FSArchNode( Name->GetUtf8(), Stat ) );
}
CurrDir = Dir;
}
return CurrDir;
}
示例4: findByFsPath
FSTmpNode* FSTmpNode::findByFsPath(FSPath* fsPath, int fsPathLevel)
{
FSString* curName = fsPath->GetItem(fsPathLevel);
if (parentDir == 0 && fsPathLevel == fsPath->Count()-1 && (curName == 0 || curName->GetUnicode() == 0 || curName->GetUnicode()[0] == 0)) // request to find root node, and we are root
return this;
if (name.Cmp(*curName) == 0)
{
if (fsPath->Count() <= fsPathLevel)
{ // exact match
return this;
}
else
{
FSString* childName = fsPath->GetItem(fsPathLevel + 1);
FSTmpNode* n = findByName(childName, false);
if (n == 0)
return 0;
if (fsPath->Count() <= fsPathLevel + 2) // no further recursion
return n;
else if (n->nodeType == NODE_DIR) // recurse into subdir
return n->findByFsPath(fsPath, fsPathLevel + 1);
else
return 0;
}
}
else
return 0;
}
示例5: StrError
FSString FSSys::StrError( int err )
{
sys_char_t buf[1024];
FSString ret;
ret.SetSys( sys_error_str( err, buf, 0x100 ) );
return ret;
}
示例6: Copy
void FSPath::Copy( const FSPath& a )
{
cacheCs = -2;
data.clear();
for ( int i = 0 ; i < a.Count(); i++ )
{
FSString s;
s.Copy( a.data.const_item( i ) );
data.append( s );
}
}
示例7: FSString
FSString FSWin32Net::StrError( int err )
{
if ( err == ERRNOSUPPORT )
{
return FSString( "Operation not supported by net fs" );
}
FSString ret;
sys_char_t buf[1024];
ret.SetSys( sys_error_str( err, buf, 0x100 ) );
return ret;
}
示例8: stripPathFromLastItem
static void stripPathFromLastItem(FSPath& path)
{
FSString* lastItem = path.GetItem(path.Count() - 1);
if (lastItem)
{
const unicode_t* lastU = lastItem->GetUnicode();
const unicode_t* lastDelim = unicode_strrchr(lastU, DIR_SPLITTER);
if (lastDelim != 0)
{
path.SetItemStr(path.Count() - 1,FSString(lastDelim + 1));
}
}
}
示例9: SetItemStr
void FSPath::SetItemStr( int n, const FSString& str ) // n>=0 && n<=Count(); если n == Count то в конец добавляется еще один элемент
{
if ( n < 0 || n > Count() ) { return; }
cacheCs = -2;
//чтоб не сработал эффект cptr
FSString s;
s.Copy( str );
if ( n == Count() ) { data.append( s ); }
else { data[n] = s; }
}
示例10: dbg_printf
FSArchNode* FSArchNode::findByName( const FSString& name, bool isRecursive )
{
dbg_printf( "FSArchNodeDir::findByName name=%s\n", name.GetUtf8() );
// first, try all nodes in current
for ( FSArchNode& n : content )
{
dbg_printf( "FSArchNodeDir::findByName n.name=%s\n", n.name.GetUtf8() );
if ( n.name.Cmp( ( FSString& ) name ) == 0 )
{
return &n;
}
}
// only if not found in current dir, try inside subdirs
if ( isRecursive )
{
for ( FSArchNode& n : content )
{
if ( n.IsDir() )
{
FSArchNode* pn = n.findByName( name, isRecursive );
if ( pn )
{
return pn;
}
}
}
}
return nullptr;
}
示例11: Cmp
int FSString::Cmp( FSString& a )
{
if ( !_primary.str() ) { return ( !a._primary.str() ) ? 0 : -1; }
if ( !a._primary.str() ) { return 1; }
return CmpStr<const unicode_t>( GetUnicode(), a.GetUnicode() );
}
示例12: findByFsPath
FSArchNode* FSArchNode::findByFsPath( FSPath& fsPath, int fsPathLevel )
{
FSString* curName = fsPath.GetItem( fsPathLevel );
if ( parentDir == nullptr
&& fsPathLevel == fsPath.Count() - 1
&& ( curName == nullptr || curName->GetUnicode() == 0 || curName->GetUnicode()[0] == 0 ) )
{
// request to find root node, and we are root
return this;
}
if ( name.Cmp( *curName ) == 0 )
{
if ( fsPath.Count() <= fsPathLevel )
{
// exact match
return this;
}
FSString* childName = fsPath.GetItem( fsPathLevel + 1 );
FSArchNode* n = findByName( *childName );
if ( n == nullptr )
{
return nullptr;
}
if ( fsPath.Count() <= fsPathLevel + 2 )
{
// no further recursion
return n;
}
if ( n->IsDir() )
{
// recurse into subdir
return n->findByFsPath( fsPath, fsPathLevel + 1 );
}
}
return nullptr;
}
示例13: Symlink
int FSSys::Symlink( FSPath& path, FSString& str, int* err, FSCInfo* info )
{
if ( symlink( ( char* )str.Get( sys_charset_id ), ( char* )path.GetString( sys_charset_id ) ) )
{
SetError( err, errno );
return -1;
}
return 0;
}
示例14: FSValue
FSString::FSString(const FSString& rhs) : FSValue(rhs), buffer(0), strLength(0), bufferLength(0)
{
strLength = rhs.length();
bufferLength = strLength + 1;
buffer = new char[bufferLength];
if (bufferLength > 0 && buffer == 0)
throw FSAllocationException("Cannot allocate memory to copy an FSString.");
strcpy(buffer, rhs.buffer);
}
示例15: OpenHomeDir
void OpenHomeDir( PanelWin* p )
{
#ifdef _WIN32
std::vector<unicode_t> homeUri = GetHomeUriWin();
if ( homeUri.data() )
{
const std::vector<clPtr<FS>> checkFS =
{
p->GetFSPtr(),
g_MainWin->GetOtherPanel( p )->GetFSPtr()
};
FSPath path;
clPtr<FS> fs = ParzeURI( homeUri.data(), path, checkFS );
if ( fs.IsNull() )
{
char buf[4096];
FSString name = homeUri.data();
Lsnprintf( buf, sizeof( buf ), "bad home path: %s\n", name.GetUtf8() );
NCMessageBox( g_MainWin, "Home", buf, true );
}
else
{
p->LoadPath( fs, path, 0, 0, PanelWin::SET );
}
}
#else
const sys_char_t* home = (sys_char_t*) getenv( "HOME" );
if ( !home )
{
return;
}
FSPath path( sys_charset_id, home );
p->LoadPath( new FSSys(), path, 0, 0, PanelWin::SET );
#endif
}