本文整理汇总了C++中AList::First方法的典型用法代码示例。如果您正苦于以下问题:C++ AList::First方法的具体用法?C++ AList::First怎么用?C++ AList::First使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AList
的用法示例。
在下文中一共展示了AList::First方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CanBeStartingCity
int ARegion::CanBeStartingCity( ARegionArray *pRA )
{
if(type == R_OCEAN) return 0;
if (!IsCoastal()) return 0;
if (town && town->pop == 5000) return 0;
int regs = 0;
AList inlist;
AList donelist;
ARegionPtr * temp = new ARegionPtr;
temp->ptr = this;
inlist.Add(temp);
while(inlist.Num()) {
ARegionPtr * reg = (ARegionPtr *) inlist.First();
for (int i=0; i<NDIRS; i++) {
ARegion * r2 = reg->ptr->neighbors[i];
if (!r2) continue;
if (r2->type == R_OCEAN) continue;
if (GetRegion(&inlist,r2->num)) continue;
if (GetRegion(&donelist,r2->num)) continue;
regs++;
if (regs>20) return 1;
ARegionPtr * temp = new ARegionPtr;
temp->ptr = r2;
inlist.Add(temp);
}
inlist.Remove(reg);
donelist.Add(reg);
}
return 0;
}
示例2: config
ADVBConfig::ADVBConfig() : config(AString(DEFAULTCONFDIR).CatPath("dvb"), false),
defaults(20, &AString::DeleteString),
webresponse(false)
{
static const struct {
const char *name;
const char *value;
} __defaults[] = {
{"prehandle", "2"},
{"posthandle", "3"},
{"pri", "0"},
{"dir", ""},
{"h264crf", "17"},
{"maxvideorate", "2000k"},
{"aacbitrate", "160k"},
{"mp3bitrate", "160k"},
{"copyvideo", "-vcodec copy"},
{"copyaudio", "-acodec copy"},
{"mp3audio", "-acodec mp3 -b:a {conf:mp3bitrate}"},
{"h264preset", "veryfast"},
{"h264bufsize", "3000k"},
{"videodeinterlace", "yadif"},
{"videofilter", "-filter:v {conf:videodeinterlace}"},
{"filters", "{conf:videofilter} {conf:audiofilter}"},
{"encodeflags", "-movflags +faststart"},
{"h264video", "-vcodec libx264 -preset {conf:h264preset} -crf {conf:h264crf} -maxrate {conf:maxvideorate} -bufsize {conf:h264bufsize} {conf:encodeflags} {conf:filters}"},
{"aacaudio", "-acodec libfdk_aac -b:a {conf:aacbitrate}"},
{"encodecopy", "{conf:copyvideo} {conf:mp3audio}"},
{"encodeh264", "{conf:h264video} {conf:aacaudio}"},
{"encodeargs", "{conf:encodeh264}"},
{"encodeaudioonlyargs", "{conf:mp3audio}"},
};
uint_t i;
for (i = 0; i < NUMBEROF(__defaults); i++) {
defaults.Insert(__defaults[i].name, (uptr_t)new AString(__defaults[i].value));
}
CreateDirectory(GetConfigDir());
CreateDirectory(GetDataDir());
CreateDirectory(GetLogDir());
CreateDirectory(GetRecordingsStorageDir());
CreateDirectory(GetRecordingsDir());
CreateDirectory(GetTempDir());
if (CommitScheduling()) {
AList users;
AString dir;
ListUsers(users);
const AString *user = AString::Cast(users.First());
while (user) {
if (((dir = GetRecordingsDir(*user)).Valid()) && (dir.Pos("{") < 0)) CreateDirectory(dir);
if (((dir = GetRecordingsArchiveDir(*user)).Valid()) && (dir.Pos("{") < 0)) CreateDirectory(dir);
user = user->Next();
}
}
}
示例3: TraverseFiles
bool TraverseFiles(const AList& list, bool (*fn)(const AFileNode& file, void *context), void *context)
{
const AListNode *node = list.First();
const AFileNode *file;
bool success = true;
while (node && success) {
if ((file = AFileNode::Cast(node)) != NULL) {
success = (*fn)(*file, context);
}
node = node->Next();
}
return success;
}
示例4: ListUsers
void ADVBConfig::ListUsers(AList& list) const
{
AHash users(10);
AList userpatterns;
AString filepattern = GetUserPatternsPattern();
AString filepattern_parsed = ParseRegex(filepattern);
AString _users = GetConfigItem("users");
AStdFile fp;
uint_t i, n = _users.CountColumns();
//debug("Reading users from config %s\n", config.GetFilename().str());
for (i = 0; i < n; i++) {
AString user = _users.Column(i).Words(0);
if (!users.Exists(user)) {
users.Insert(user, 0);
list.Add(new AString(user));
}
}
if (fp.open(GetPatternsFile())) {
AString line;
while (line.ReadLn(fp) >= 0) {
AString user;
int p;
if ((p = line.PosNoCase(" user:=")) >= 0) user = line.Mid(p + 7).Word(0).DeQuotify();
else if (line.PosNoCase("user:=") == 0) user = line.Mid(6).Word(0).DeQuotify();
if (user.Valid() && !users.Exists(user)) {
users.Insert(user, 0);
list.Add(new AString(user));
}
}
fp.close();
}
::CollectFiles(filepattern.PathPart(), filepattern.FilePart(), 0, userpatterns);
const AString *file = AString::Cast(userpatterns.First());
while (file) {
AString user;
ADataList regions;
if (MatchRegex(*file, filepattern_parsed, regions)) {
const REGEXREGION *region = (const REGEXREGION *)regions[0];
if (region) {
user = file->Mid(region->pos, region->len);
if (!users.Exists(user)) {
users.Insert(user, 0);
list.Add(new AString(user));
}
}
}
file = file->Next();
}
list.Sort(&AString::AlphaCompareCase);
}