本文整理汇总了C++中BFile::GetStr方法的典型用法代码示例。如果您正苦于以下问题:C++ BFile::GetStr方法的具体用法?C++ BFile::GetStr怎么用?C++ BFile::GetStr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BFile
的用法示例。
在下文中一共展示了BFile::GetStr方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UxMntList
bool UxMntList( wal::ccollect< MntListNode >* pList )
{
if ( !pList ) { return false; }
try
{
BFile f;
f.Open( ( sys_char_t* )"/proc/mounts" );
char buf[4096];
while ( f.GetStr( buf, sizeof( buf ) ) )
{
char* w[3];
int n = GetNWords( buf, w, 3 );
if ( n < 3 ) { continue; }
if ( !strcmp( w[0], "none" ) ) { continue; }
if ( !strcmp( w[1], "/" ) ) { continue; }
if ( !strcmp( w[2], "tmpfs" ) ) { continue; }
if ( !strcmp( w[2], "sysfs" ) ) { continue; }
if ( !strcmp( w[2], "cgroup" ) ) { continue; }
char* p = w[1];
if ( p[0] == '/' && p[1] == 'p' && p[2] == 'r' && p[3] == 'o' && p[4] == 'c' && ( p[5] == '/' || !p[5] ) ) { continue; } // skip /proc[/...]
if ( p[0] == '/' && p[1] == 'd' && p[2] == 'e' && p[3] == 'v' && ( p[4] == '/' || !p[4] ) ) { continue; } //skip /dev[/...]
MntListNode node;
node.path = w[1];
node.type = w[2];
pList->append( node );
}
}
catch ( cexception* ex )
{
ex->destroy();
return false;
}
return true;
}
示例2: LangListLoad
static bool LangListLoad(sys_char_t *fileName, ccollect<LangListNode> &list)
{
list.clear();
try {
BFile f;
f.Open(fileName);
char buf[4096];
while (f.GetStr(buf, sizeof(buf)))
{
char *s = buf;
while (IsSpace(*s)) s++;
if (*s == '#') continue;
if (!*s) continue;
ccollect<char,0x100> id;
ccollect<char,0x100> name;
while (*s && !IsSpace(*s)) {
id.append(*s);
s++;
}
while (IsSpace(*s)) s++;
int lastNs = -1;
for (int i = 0; *s; i++, s++) {
if (*s == '#') break;
if (!IsSpace(*s)) lastNs = i;
name.append(*s);
}
if (id.count()<=0 || lastNs < 0) continue;
id.append(0);
name.append(0);
name[lastNs + 1] = 0;
LangListNode(id.ptr(), name.ptr());
list.append(LangListNode(id.ptr(), name.ptr()) );
}
} catch (cexception *ex) {
ex->destroy();
return false;
}
return true;
}
示例3: Refresh
void MimeAliases::Refresh()
{
time_t tim = GetMTime( fileName.data() );
if ( tim == mtime ) { return; }
mtime = tim;
data.clear();
try
{
BFile f;
f.Open( fileName.data() ); //"/usr/share/mime/aliases");
char buf[4096];
while ( f.GetStr( buf, sizeof( buf ) ) )
{
char* s = SS( buf );
if ( *s == '#' ) { continue; } //комментарий
char* p = SNotS( s );
if ( !p ) { continue; }
*p = 0;
p++;
p = SS( p );
char* t = SNotS( p );
if ( t ) { *t = 0; }
data[GetMimeID( s )] = GetMimeID( p );
}
}
catch ( cexception* ex )
{
ex->destroy();
return;
}
}
示例4: ReadAppDesctopFile
bool AppDB::ReadAppDesctopFile( const char* name )
{
int id = GetAppID( name );
if ( apps.find( id ) != apps.end() ) { return true; }
clPtr<AppNode> app = new AppNode();
try
{
BFile f;
f.Open( carray_cat<char>( appDefsPrefix.data(), name ).data() );
char buf[4096];
bool ok = false;
bool application = false;
ccollect<int> mimeList;
while ( f.GetStr( buf, sizeof( buf ) ) )
{
EraseLastSpaces( buf );
char* s = buf;
s = SS( s );
if ( *s == '[' )
{
ok = !CmpNoCase( s, "[Desktop Entry]" );
continue;
}
if ( !ok ) { continue; }
char* vname = s;
while ( *s && !IsSpace( *s ) && *s != '=' ) { s++; }
if ( IsSpace( *s ) )
{
*s = 0;
s++;
s = SS( s );
}
if ( *s != '=' )
{
continue;
}
*s = 0;
s++;
s = SS( s );
if ( !CmpNoCase( vname, "TYPE" ) )
{
if ( !CmpNoCase( s, "APPLICATION" ) ) { application = true; }
continue;
}
if ( !CmpNoCase( vname, "NAME" ) )
{
app->name = utf8_to_unicode( s );
continue;
}
if ( !CmpNoCase( vname, "EXEC" ) )
{
app->exec = utf8_to_unicode( s );
continue;
}
if ( !CmpNoCase( vname, "TRYEXEC" ) ) //проверяем сразу, чего каждый раз проверять
{
if ( !ExeFileExist( s ) )
{
apps[id] = 0;
return 0;
}
continue;
}
if ( !CmpNoCase( vname, "TERMINAL" ) )
{
if ( !CmpNoCase( s, "TRUE" ) )
{
app->terminal = true;
}
else if ( !CmpNoCase( s, "FALSE" ) )
{
app->terminal = false;
}
continue;
}
//.........这里部分代码省略.........