本文整理汇总了C++中ObjData函数的典型用法代码示例。如果您正苦于以下问题:C++ ObjData函数的具体用法?C++ ObjData怎么用?C++ ObjData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ObjData函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: String_cmp
static int String_cmp(DOH *so1, DOH *so2) {
String *s1, *s2;
char *c1, *c2;
int maxlen, i;
s1 = (String *) ObjData(so1);
s2 = (String *) ObjData(so2);
maxlen = s1->len;
if (s2->len < maxlen)
maxlen = s2->len;
c1 = s1->str;
c2 = s2->str;
for (i = maxlen; i; --i, c1++, c2++) {
if (*c1 != *c2)
break;
}
if (i != 0) {
if (*c1 < *c2)
return -1;
else
return 1;
}
if (s1->len == s2->len)
return 0;
if (s1->len > s2->len)
return 1;
return -1;
}
开发者ID:GSGroup,项目名称:swig-v8,代码行数:27,代码来源:string.c
示例2: String_equal
static int String_equal(DOH *so1, DOH *so2) {
String *s1 = (String *) ObjData(so1);
String *s2 = (String *) ObjData(so2);
register int len = s1->len;
if (len != s2->len) {
return 0;
} else {
register char *c1 = s1->str;
register char *c2 = s2->str;
#if 0
register int mlen = len >> 2;
register int i = mlen;
for (; i; --i) {
if (*(c1++) != *(c2++))
return 0;
if (*(c1++) != *(c2++))
return 0;
if (*(c1++) != *(c2++))
return 0;
if (*(c1++) != *(c2++))
return 0;
}
for (i = len - (mlen << 2); i; --i) {
if (*(c1++) != *(c2++))
return 0;
}
return 1;
#else
return memcmp(c1, c2, len) == 0;
#endif
}
}
开发者ID:GSGroup,项目名称:swig-v8,代码行数:32,代码来源:string.c
示例3: String_insert
static int String_insert(DOH *so, int pos, DOH *str) {
String *s;
char *nstr;
int len;
char *data;
if (pos == DOH_END) {
DohString_append(so, str);
return 0;
}
s = (String *) ObjData(so);
s->hashkey = -1;
if (DohCheck(str)) {
String *ss = (String *) ObjData(str);
data = (char *) String_data(str);
len = ss->len;
} else {
data = (char *) (str);
len = (int) strlen(data);
}
nstr = s->str;
if (pos < 0)
pos = 0;
else if (pos > s->len)
pos = s->len;
/* See if there is room to insert the new data */
while (s->maxsize <= s->len + len) {
int newsize = 2 * s->maxsize;
s->str = (char *) DohRealloc(s->str, newsize);
assert(s->str);
s->maxsize = newsize;
}
memmove(s->str + pos + len, s->str + pos, (s->len - pos));
memcpy(s->str + pos, data, len);
if (s->sp >= pos) {
int i;
for (i = 0; i < len; i++) {
if (data[i] == '\n')
s->line++;
}
s->sp += len;
}
s->len += len;
s->str[s->len] = 0;
return 0;
}
开发者ID:charlie5,项目名称:swig4ada,代码行数:51,代码来源:string.c
示例4: String_putc
static int
String_putc(DOH *so, int ch)
{
register int len, maxsize, sp;
String *s = (String *) ObjData(so);
s->hashkey = -1;
len = s->len;
sp = s->sp;
if (sp >= len) {
register char *tc;
maxsize = s->maxsize;
if (len > (maxsize-2)) {
s->str = (char *) DohRealloc(s->str,2*maxsize);
assert(s->str);
s->maxsize = 2*maxsize;
}
tc = s->str + len;
*(tc++) = ch;
if (sp >= len) {
s->sp = len+1;
*tc = 0;
if (ch == '\n') s->line++;
}
s->len = len+1;
} else {
s->str[s->sp++] = (char) ch;
if (ch == '\n') s->line++;
}
return ch;
}
开发者ID:kanbang,项目名称:Colt,代码行数:30,代码来源:string.c
示例5: String_str
static DOH *
String_str(DOH *so)
{
String *s = (String *) ObjData(so);
s->str[s->len] = 0;
return NewString(s->str);
}
开发者ID:kanbang,项目名称:Colt,代码行数:7,代码来源:string.c
示例6: ObjTag
BOOL CRTDBTopic::CreateNewRequestItem(const char* pszItem)
{
Strng Tag, Cnv;
TaggedObject::SplitTagCnv((char*)pszItem, Tag, Cnv);
CXM_Route ObjRoute;
CXM_ObjectTag ObjTag(Tag(), TABOpt_AllInfo);
CXM_ObjectData ObjData(0);
DWORD RetCode = pDdeExec->XReadTaggedItem(ObjTag, ObjData, ObjRoute);
//LogNote(Tag(), 0, "DDE: '%s' %s", pszItem, RetCode ? "Found" : "Not Found");
if (RetCode==0)
LogError(Tag(), 0, "DDE: Tag request for '%s' not found", pszItem);
pDdeExec->StatsCnt[RetCode==0 ? 3 : 1]++;
if (RetCode) //This is a configured point so go and add the item
{
m_pServer->Lock();
CPkDataItem * pPItem = ObjData.FirstItem();
CRTDBItem* pItem = new CRTDBItem();
pItem->iCnvIndex = pPItem->CnvIndex();
pItem->Create(pszItem);
AddItem(pItem);
m_pServer->Release();
pItem->SetDataOnly(pPItem->Value()->GetString("%i", "%g", pItem->iCnvIndex, Cnv()));
pDdeExec->XBuildMyDataLists();
return TRUE;
}
return FALSE;
}
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:31,代码来源:DDE_EXEC.CPP
示例7: List_next
static DOH *
List_next(DOH *lo) {
List *l = (List *) ObjData(lo);
l->iter++;
if (l->iter >= l->nitems) return 0;
return l->items[l->iter];
}
开发者ID:s1d,项目名称:sniffjoke,代码行数:7,代码来源:list.c
示例8: String_putc
static int String_putc(DOH *so, int ch) {
String *s = (String *) ObjData(so);
register int len = s->len;
register int sp = s->sp;
s->hashkey = -1;
if (sp >= len) {
register int maxsize = s->maxsize;
register char *tc = s->str;
if (len > (maxsize - 2)) {
maxsize *= 2;
tc = (char *) DohRealloc(tc, maxsize);
assert(tc);
s->maxsize = (int) maxsize;
s->str = tc;
}
tc += sp;
*tc = (char) ch;
*(++tc) = 0;
s->len = s->sp = sp + 1;
} else {
s->str[s->sp++] = (char) ch;
}
if (ch == '\n')
s->line++;
return ch;
}
开发者ID:GSGroup,项目名称:swig-v8,代码行数:26,代码来源:string.c
示例9: List_insert
static int List_insert(DOH *lo, int pos, DOH *item) {
List *l = (List *) ObjData(lo);
int i;
if (!item)
return -1;
if (!DohCheck(item)) {
item = NewString(item);
Decref(item);
}
if (pos == DOH_END)
pos = l->nitems;
if (pos < 0)
pos = 0;
if (pos > l->nitems)
pos = l->nitems;
if (l->nitems == l->maxitems)
more(l);
for (i = l->nitems; i > pos; i--) {
l->items[i] = l->items[i - 1];
}
l->items[pos] = item;
Incref(item);
l->nitems++;
return 0;
}
开发者ID:abhishekgahlot,项目名称:Python-Fingerprint-Attendance-System,代码行数:26,代码来源:list.c
示例10: String_delslice
static int
String_delslice(DOH *so, int sindex, int eindex) {
String *s = (String *) ObjData(so);
int size;
s->hashkey = -1;
if (eindex == DOH_END) eindex = s->len;
if (sindex == DOH_BEGIN) sindex = 0;
if (s->len == 0) return 0;
size = eindex - sindex;
if (s->sp > eindex) {
/* Adjust the file pointer and line count */
char *c = s->str + sindex;
int i;
for (i = 0; i < size; i++) {
if (*c == '\n') s->line--;
}
s->sp -= size;
assert(s->sp >= 0);
}
memmove(s->str+sindex,s->str+eindex, ((s->len-size) - sindex));
s->len -= size;
s->str[s->len] = 0;
return 0;
}
开发者ID:kanbang,项目名称:Colt,代码行数:25,代码来源:string.c
示例11: String_delslice
static int String_delslice(DOH *so, int sindex, int eindex) {
String *s = (String *) ObjData(so);
int size;
if (s->len == 0)
return 0;
s->hashkey = -1;
if (eindex == DOH_END)
eindex = s->len;
if (sindex == DOH_BEGIN)
sindex = 0;
size = eindex - sindex;
if (s->sp > sindex) {
/* Adjust the file pointer and line count */
int i, end;
if (s->sp > eindex) {
end = eindex;
s->sp -= size;
} else {
end = s->sp;
s->sp = sindex;
}
for (i = sindex; i < end; i++) {
if (s->str[i] == '\n')
s->line--;
}
assert(s->sp >= 0);
}
memmove(s->str + sindex, s->str + eindex, s->len - eindex);
s->len -= size;
s->str[s->len] = 0;
return 0;
}
开发者ID:GSGroup,项目名称:swig-v8,代码行数:33,代码来源:string.c
示例12: DelString
static void
DelString(DOH *so) {
String *s = (String *) ObjData(so);
s->hashkey = -1;
DohFree(s->str);
s->str = 0;
DohFree(s);
}
开发者ID:kanbang,项目名称:Colt,代码行数:8,代码来源:string.c
示例13: String_clear
static void String_clear(DOH *so) {
String *s = (String *) ObjData(so);
s->hashkey = -1;
s->len = 0;
*(s->str) = 0;
s->sp = 0;
s->line = 1;
}
开发者ID:GSGroup,项目名称:swig-v8,代码行数:8,代码来源:string.c
示例14: List_clear
static void List_clear(DOH *lo) {
List *l = (List *) ObjData(lo);
int i;
for (i = 0; i < l->nitems; i++) {
Delete(l->items[i]);
}
l->nitems = 0;
}
开发者ID:abhishekgahlot,项目名称:Python-Fingerprint-Attendance-System,代码行数:8,代码来源:list.c
示例15: List_get
static DOH *
List_get(DOH *lo, int n) {
List *l = (List *) ObjData(lo);
if (n == DOH_END) n = l->nitems-1;
if (n == DOH_BEGIN) n = 0;
assert(!((n < 0) || (n >= l->nitems)));
return l->items[n];
}
开发者ID:kanbang,项目名称:Colt,代码行数:8,代码来源:list.c
示例16: DelList
static void DelList(DOH *lo) {
List *l = (List *) ObjData(lo);
int i;
for (i = 0; i < l->nitems; i++)
Delete(l->items[i]);
DohFree(l->items);
DohFree(l);
}
开发者ID:abhishekgahlot,项目名称:Python-Fingerprint-Attendance-System,代码行数:8,代码来源:list.c
示例17: DohSortList
/* Sort a list */
void DohSortList(DOH *lo, int (*cmp) (const DOH *, const DOH *)) {
List *l = (List *) ObjData(lo);
if (cmp) {
List_sort_compare_func = cmp;
} else {
List_sort_compare_func = DohCmp;
}
qsort(l->items, l->nitems, sizeof(DOH *), List_qsort_compare);
}
开发者ID:abhishekgahlot,项目名称:Python-Fingerprint-Attendance-System,代码行数:10,代码来源:list.c
示例18: String_ungetc
static int
String_ungetc(DOH *so, int ch)
{
String *s = (String *) ObjData(so);
if (ch == EOF) return ch;
if (s->sp <= 0) return EOF;
s->sp--;
if (ch == '\n') s->line--;
return ch;
}
开发者ID:kanbang,项目名称:Colt,代码行数:10,代码来源:string.c
示例19: DohString_append
static void DohString_append(DOH *so, const DOHString_or_char *str) {
int oldlen, newlen, newmaxsize, l, sp;
char *tc;
String *s = (String *) ObjData(so);
char *newstr = 0;
if (DohCheck(str)) {
String *ss = (String *) ObjData(str);
newstr = (char *) String_data((DOH *) str);
l = ss->len;
} else {
newstr = (char *) (str);
l = (int) strlen(newstr);
}
if (!newstr)
return;
s->hashkey = -1;
oldlen = s->len;
newlen = oldlen + l + 1;
if (newlen >= s->maxsize - 1) {
newmaxsize = 2 * s->maxsize;
if (newlen >= newmaxsize - 1)
newmaxsize = newlen + 1;
s->str = (char *) DohRealloc(s->str, newmaxsize);
assert(s->str);
s->maxsize = newmaxsize;
}
tc = s->str;
memcpy(tc + oldlen, newstr, l + 1);
sp = s->sp;
if (sp >= oldlen) {
int i = oldlen + l - sp;
tc += sp;
for (; i; --i) {
if (*(tc++) == '\n')
s->line++;
}
s->sp = oldlen + l;
}
s->len += l;
}
开发者ID:GSGroup,项目名称:swig-v8,代码行数:42,代码来源:string.c
示例20: List_next
static DohIterator List_next(DohIterator iter) {
List *l = (List *) ObjData(iter.object);
iter._index = iter._index + 1;
if (iter._index >= l->nitems) {
iter.item = 0;
iter.key = 0;
} else {
iter.item = l->items[iter._index];
}
return iter;
}
开发者ID:abhishekgahlot,项目名称:Python-Fingerprint-Attendance-System,代码行数:11,代码来源:list.c
注:本文中的ObjData函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论