本文整理汇总了C++中Array::GetCount方法的典型用法代码示例。如果您正苦于以下问题:C++ Array::GetCount方法的具体用法?C++ Array::GetCount怎么用?C++ Array::GetCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Array
的用法示例。
在下文中一共展示了Array::GetCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EndPart
void RichQtfParser::EndPart()
{
if(istable) {
if(paragraph.GetCount() == 0 && text.GetCount() == 0)
if(table.GetCount())
table.Top().text.CatPick(pick(tablepart));
else
target.CatPick(pick(tablepart));
else {
paragraph.part.Clear();
text.Clear();
}
}
else {
Flush();
bool b = paragraph.format.newpage;
if(breakpage)
paragraph.format.newpage = true;
if(table.GetCount())
table.Top().text.Cat(paragraph, target.GetStyles());
else
target.Cat(paragraph);
paragraph.part.Clear();;
paragraph.format.newpage = b;
SetFormat();
breakpage = false;
}
istable = false;
}
示例2: RowColor
//задание цвета строки
void AnimeList::RowColor(int row)
{
Date release;
Array<CellSeries> array;
Date today = GetSysDate();
String xml = listName.Get(row, SeriesRelease);
String number, date;
int ep = listName.Get(row, Episodes);
int ser;
if(xml.GetCount() > 0)
{
int pos;
while(xml.GetCount() > 0){
pos = xml.Find("-");
if(pos > 0)
{
number = String(xml, pos);
xml.Remove(0, pos + 1);
date = String(xml, 10);
xml.Remove(0, 11);
series.number = StrInt(number);
StrToDate(series.release, date);
array.Add(series);
}
}
release = array[array.GetCount()-1].release;
if((ep == array[array.GetCount()-1].number) & (today < release))
ser = array[array.GetCount()-1].number - 1;
else
ser = ((today - release) / 7) + array[array.GetCount()-1].number;
} else
{
release = listName.Get(row, Release);
ser = ((today - release) / 7) + 1;
}
int views = listName.Get(row, Views);
if(views == ep) //полностью просмотрено
for(int i=0;i<listName.GetColumnCount();i++)
listName.SetDisplay(row, i, Single<ColumnBlue>());
else
if((views < ep) & (views != 0) & (views == ser)) //нет новых серий, в просмотре
for(int i=0;i<listName.GetColumnCount();i++)
listName.SetDisplay(row, i, Single<ColumnGreen>());
else
if((views < ep) & (views != 0) & (views < ser)) //есть новые серии, в просмотре
for(int i=0;i<listName.GetColumnCount();i++)
listName.SetDisplay(row, i, Single<ColumnRed>());
else
if(views == 0) //нет просмотренных серий
for(int i=0;i<listName.GetColumnCount();i++)
listName.SetDisplay(row, i, Single<ColumnDefault>());
}
示例3: Init
void VFS::Init(const wxString& path)
{
UnMountAll();
Array<VFSManagerEntry> entries;
SaveLoadDevices(entries, true);
for(uint i=0; i<entries.GetCount(); ++i)
{
vfsDevice* dev;
switch(entries[i].device)
{
case vfsDevice_LocalFile:
dev = new vfsDeviceLocalFile();
break;
case vfsDevice_HDD:
dev = new vfsDeviceHDD(entries[i].device_path);
break;
default:
continue;
}
wxString mpath = entries[i].path;
mpath.Replace("$(EmulatorDir)", wxGetCwd());
mpath.Replace("$(GameDir)", vfsDevice::GetRoot(path));
Mount(entries[i].mount, mpath, dev);
}
}
示例4: PackParts
void RichPara::PackParts(Stream& out, const RichPara::CharFormat& chrstyle,
const Array<RichPara::Part>& part, CharFormat& cf,
Array<RichObject>& obj) const
{
for(int i = 0; i < part.GetCount(); i++) {
const Part& p = part[i];
Charformat(out, cf, p.format, chrstyle);
cf = p.format;
if(p.field) {
out.Put(FIELD);
String s = ~p.field;
out % s;
s = p.fieldparam;
out % s;
StringStream oout;
CharFormat subf = cf;
PackParts(oout, chrstyle, p.fieldpart, subf, obj);
s = oout;
out % s;
}
else
if(p.object) {
obj.Add(p.object);
out.Put(OBJECT);
}
else
out.Put(ToUtf8(p.text));
}
}
示例5: EnumerateClassesForProvider
void EnumerateClassesForProvider(Service *provider, const Function<bool (MetaClass *meta, Dictionary *properties)> &callback)
{
MetaClass *providerClass = provider->GetClass();
spinlock_lock(&_matchingLock);
Array *matches = Array::Alloc()->Init();
for(size_t i = 0; i < _registeredClasses->GetCount(); i ++)
{
ClassEntry *entry = _registeredClasses->GetObjectAtIndex<ClassEntry>(i);
if(!entry->IsMatched() && DoShallowMatch(providerClass, entry))
matches->AddObject(entry);
}
spinlock_unlock(&_matchingLock);
for(size_t i = 0; i < matches->GetCount(); i ++)
{
ClassEntry *entry = matches->GetObjectAtIndex<ClassEntry>(i);
if(callback(entry->GetMeta(), entry->GetProperties()))
entry->SetMatched(true);
}
matches->Release();
}
示例6: SplitPoly
static Rectf SplitPoly(const Array<Pointf>& polygon, const Vector<int>& polyend, bool closed,
Array<PolyPart>& parts)
{
if(polyend.IsEmpty())
return Null;
unsigned c = polygon.GetCount();
int n = 1;
if(c >= 1 << 16) { c >>= 16; n <<= 8; }
示例7: FindLangString
bool CodeEditor::FindLangString(bool back)
{
int l, h;
if(!GetSelection(l, h)) h = GetCursor();
else h = (back ? l : h);
h -= GetPos(l = GetLine(h));
for(;;)
{
Array<IdentPos> list = GetLineIdent(GetUtf8Line(l));
int b, e;
if(back)
{
int i = list.GetCount();
while(--i >= 0 && list[i].begin >= h)
;
if(i < 0)
{
h = 1000000;
if(--l < 0)
break;
continue;
}
b = GetPos(l, list[i].begin);
e = GetPos(l, list[i].end);
}
else
{
int i = 0;
while(i < list.GetCount() && list[i].end <= h)
i++;
if(i >= list.GetCount())
{
h = 0;
if(++l >= GetLineCount())
break;
continue;
}
b = GetPos(l, list[i].begin);
e = GetPos(l, list[i].end);
}
SetSelection(b, e);
return true;
}
return false;
}
示例8: HasItem
bool HasItem(const Array<CppItem>& n, const String& m)
{
if(IsNull(m))
return true;
for(int i = 0; i < n.GetCount(); i++)
if(n[i].uname.StartsWith(m))
return true;
return false;
}
示例9: MatchPm
bool MatchPm(const Array<CppItem>& n, const String& pm)
{
if(IsNull(pm))
return true;
for(int i = 0; i < n.GetCount(); i++)
if(MatchPm(n[i].file, pm))
return true;
return false;
}
示例10:
AudioConfig()
: m_is_audio_initialized(false)
, m_port_in_use(0)
, event_key(0)
{
m_ports.SetCount(8);
for (u32 i = 0; i < m_ports.GetCount(); i++)
m_ports[i] = nullptr;
}
示例11: GetWorkArea
Rect Ctrl::GetWorkArea(Point pt)
{
Array<Rect> rc;
GetWorkArea(rc);
for(int i = 0; i < rc.GetCount(); i++)
if(rc[i].Contains(pt))
return rc[i];
return GetPrimaryWorkArea();
}
示例12: GetVirtualWorkArea
Rect Ctrl::GetVirtualWorkArea()
{
Rect out = GetPrimaryWorkArea();
Array<Rect> rc;
GetWorkArea(rc);
for(int i = 0; i < rc.GetCount(); i++)
out |= rc[i];
return out;
}
示例13: Gather
String Gather(const Array<OptItem>& set, const Vector<String>& conf, bool nospace) {
String s;
for(int i = 0; i < set.GetCount(); i++)
if(MatchWhen(set[i].when, conf)) {
if(!nospace && !s.IsEmpty()) s.Cat(' ');
s.Cat(set[i].text);
}
return s;
}
示例14: sys_event_flag_cancel
int sys_event_flag_cancel(u32 eflag_id, mem32_t num)
{
sys_event_flag.Warning("sys_event_flag_cancel(eflag_id=%d, num_addr=0x%x)", eflag_id, num.GetAddr());
EventFlag* ef;
if(!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;
Array<u32> tids;
{
SMutexLocker lock(ef->m_mutex);
tids.SetCount(ef->waiters.GetCount());
for (u32 i = 0; i < ef->waiters.GetCount(); i++)
{
tids[i] = ef->waiters[i].tid;
}
ef->waiters.Clear();
}
for (u32 i = 0; i < tids.GetCount(); i++)
{
if (Emu.IsStopped()) break;
ef->signal.lock(tids[i]);
}
if (Emu.IsStopped())
{
ConLog.Warning("sys_event_flag_cancel(id=%d) aborted", eflag_id);
return CELL_OK;
}
if (num.IsGood())
{
num = tids.GetCount();
return CELL_OK;
}
if (!num.GetAddr())
{
return CELL_OK;
}
return CELL_EFAULT;
}
示例15: GetBatteryStatus
NAMESPACE_UPP
#ifdef PLATFORM_POSIX
bool GetBatteryStatus(bool &discharging, int &percentage, int &remainingMin)
{
/* This is only if acpi package is present
StringParse data = Sys("acpi -V");
data.GoAfter("AC Adapter", ":");
String sacStatus = data.GetText();
discharging = sacStatus != "on-line";
data.GoInit();
data.GoAfter("Battery", ":");
data.GoAfter(",");
percentage = data.GetInt("%");
data.GoAfter(",");
String remaining;
if (discharging) {
remaining = data.GetText(" ");
int hour, min;
double secs;
StringToHMS(remaining, hour, min, secs); // It is really days:hour:min in this case
remainingMin = int(secs) + min*60 + hour*24*60;
} else
remainingMin = Null;
*/
percentage = 100;
Array<String> files = SearchFile("/proc/acpi/battery", "state");
if (files.GetCount() == 0)
return false;
StringParse state = LoadFile_Safe(files[0]);
if (state == "")
return false;
bool present;
if(!state.GoAfter_Init("present", ":"))
return false;
present = state.GetText() == "yes";
if (!present)
return false; // No battery inserted
state.GoAfter_Init("charging state", ":"); discharging = state.GetText() == "discharging";
int presentRate, remainingCapacity;
state.GoAfter_Init("present rate", ":"); presentRate = state.GetInt();
state.GoAfter_Init("remaining capacity", ":"); remainingCapacity = state.GetInt();
if (presentRate == 0 || !discharging)
remainingMin = Null;
else
remainingMin = (int)((60.*remainingCapacity)/presentRate);
int designCapacity,lastFullCapacity;
String vendor, type, model, serial;
if (!GetBatteryInfo(present/*, designCapacity, lastFullCapacity, vendor, type, model, serial*/))
percentage = (int)((100.*remainingCapacity)/lastFullCapacity);
return true;
}