本文整理汇总了C++中ObjData函数的典型用法代码示例。如果您正苦于以下问题:C++ ObjData函数的具体用法?C++ ObjData怎么用?C++ ObjData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ObjData函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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
}
}
示例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;
}
示例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;
}
示例5: String_str
static DOH *
String_str(DOH *so)
{
String *s = (String *) ObjData(so);
s->str[s->len] = 0;
return NewString(s->str);
}
示例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;
}
示例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];
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例12: DelString
static void
DelString(DOH *so) {
String *s = (String *) ObjData(so);
s->hashkey = -1;
DohFree(s->str);
s->str = 0;
DohFree(s);
}
示例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;
}
示例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;
}
示例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];
}