本文整理汇总了C++中TStrings::Value方法的典型用法代码示例。如果您正苦于以下问题:C++ TStrings::Value方法的具体用法?C++ TStrings::Value怎么用?C++ TStrings::Value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TStrings
的用法示例。
在下文中一共展示了TStrings::Value方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ecmd_readfsdetect
/** return FS detection list.
Function returns parsed [fsdetect] section contents, in the single module
owned heap block. Last entry in this list is zero-filled */
fs_detect_list* ecmd_readfsdetect() {
TStrings lst;
if (!ecmd_readsec("fsdetect",lst)) return 0;
u32t ii, blen = 0, nlen = 0, ecnt = 0;
for (ii=0; ii<lst.Count(); ii++) {
// filter out commented lines
if (lst[ii][0]!=';') {
spstr val = lst.Value(ii);
if (val.words(",")==2) {
blen += val.word(2,",").words();
nlen += lst.Name(ii).trim().length()+1;
ecnt++;
continue;
}
}
lst[ii].clear();
}
if (!blen || !nlen) return 0;
// alloc/calc block pointers
u32t listlen = sizeof(fs_detect_list)*(ecnt+1), idx;
fs_detect_list *res = (fs_detect_list*)malloc(listlen+blen+nlen);
char *nptr = (char*)res + listlen;
u8t *dptr = (u8t*)nptr + nlen;
// zero last entry
memset(res+ecnt, 0, sizeof(fs_detect_list));
// build return information in the single memory block
for (ii=0, idx=0; ii<lst.Count(); ii++)
if (lst[ii].length()) {
spstr val = lst.Value(ii),
key = lst.Name(ii).trim();
spstr bstr = val.word(2,",");
res[idx].fsname = nptr;
res[idx].offset = val.word_Dword(1,",");
res[idx].size = bstr.words();
res[idx].cmpdata = dptr;
// fa name
memcpy(nptr, key(), key.length()+1);
nptr += key.length()+1;
// binary data to cmp
for (u32t ll=0; ll<res[idx].size; ll++)
*dptr++ = strtoul(bstr() + bstr.wordpos(ll+1), 0, 16);
idx++;
}
return res;
}