本文整理汇总了C++中GWEN_Buffer_GetStart函数的典型用法代码示例。如果您正苦于以下问题:C++ GWEN_Buffer_GetStart函数的具体用法?C++ GWEN_Buffer_GetStart怎么用?C++ GWEN_Buffer_GetStart使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GWEN_Buffer_GetStart函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GWEN_Buffer_AppendString
GWEN_DIALOG *Dlg_Test1_new() {
GWEN_DIALOG *dlg;
int rv;
const char *s;
GWEN_BUFFER *tbuf;
tbuf=GWEN_Buffer_new(0, 256, 0, 1);
s=getenv("DIALOG_DIR");
if (s && *s)
GWEN_Buffer_AppendString(tbuf, s);
else
GWEN_Buffer_AppendString(tbuf, MEDIAPATH);
dlg=GWEN_Dialog_new("dlg_test");
GWEN_Dialog_SetSignalHandler(dlg, _gwenGuiSignalHandler);
GWEN_Dialog_AddMediaPath(dlg, GWEN_Buffer_GetStart(tbuf));
/* read dialog from dialog description file */
GWEN_Buffer_AppendString(tbuf, GWEN_DIR_SEPARATOR_S "dlg_test.dlg");
rv=GWEN_Dialog_ReadXmlFile(dlg, GWEN_Buffer_GetStart(tbuf));
GWEN_Buffer_free(tbuf);
if (rv<0) {
DBG_INFO(GWEN_LOGDOMAIN, "here (%d).", rv);
GWEN_Dialog_free(dlg);
return NULL;
}
/* done */
return dlg;
}
示例2: GWEN_Directory_FindPathForFile
int GWEN_Directory_FindPathForFile(const GWEN_STRINGLIST *paths,
const char *filePath,
GWEN_BUFFER *fbuf) {
GWEN_STRINGLISTENTRY *se;
se=GWEN_StringList_FirstEntry(paths);
while(se) {
GWEN_BUFFER *tbuf;
FILE *f;
tbuf=GWEN_Buffer_new(0, 256, 0, 1);
GWEN_Buffer_AppendString(tbuf, GWEN_StringListEntry_Data(se));
GWEN_Buffer_AppendString(tbuf, DIRSEP);
GWEN_Buffer_AppendString(tbuf, filePath);
DBG_VERBOUS(GWEN_LOGDOMAIN, "Trying \"%s\"",
GWEN_Buffer_GetStart(tbuf));
f=fopen(GWEN_Buffer_GetStart(tbuf), "r");
if (f) {
fclose(f);
DBG_INFO(GWEN_LOGDOMAIN,
"File \"%s\" found in folder \"%s\"",
filePath,
GWEN_StringListEntry_Data(se));
GWEN_Buffer_AppendString(fbuf, GWEN_StringListEntry_Data(se));
GWEN_Buffer_free(tbuf);
return 0;
}
GWEN_Buffer_free(tbuf);
se=GWEN_StringListEntry_Next(se);
}
DBG_INFO(GWEN_LOGDOMAIN, "File \"%s\" not found", filePath);
return GWEN_ERROR_NOT_FOUND;
}
示例3: GWEN_Gui_CProgress_Log
int GWEN_Gui_CProgress_Log(GWEN_GUI_CPROGRESS *cp,
GWEN_UNUSED GWEN_LOGGER_LEVEL level,
const char *text)
{
assert(cp);
assert(text);
if (!(GWEN_Gui_GetFlags(cp->gui) & GWEN_GUI_FLAGS_NONINTERACTIVE)) {
GWEN_BUFFER *tbuf;
const char *t;
tbuf=GWEN_Buffer_new(0, 256, 0, 1);
GWEN_Gui_GetRawText(cp->gui, text, tbuf);
t=GWEN_Buffer_GetStart(tbuf);
if (t[GWEN_Buffer_GetUsedBytes(tbuf)-1]!='\n') {
GWEN_Buffer_AppendByte(tbuf, '\n');
/* Just in case the buffer has been reallocated */
t=GWEN_Buffer_GetStart(tbuf);
}
GWEN_Gui_StdPrintf(cp->gui, stderr, "%s", t);
GWEN_Buffer_AppendString(cp->logBuf, t);
GWEN_Buffer_free(tbuf);
tbuf=0;
if (cp->aborted)
return GWEN_ERROR_USER_ABORTED;
}
return 0;
}
示例4: GWEN_Buffer_AppendString
GWEN_TIME *AB_ImExporter_DateFromString(const char *p, const char *tmpl,
int inUtc) {
GWEN_TIME *ti;
if (strchr(tmpl, 'h')==0) {
GWEN_BUFFER *dbuf;
GWEN_BUFFER *tbuf;
dbuf=GWEN_Buffer_new(0, 32, 0, 1);
GWEN_Buffer_AppendString(dbuf, p);
GWEN_Buffer_AppendString(dbuf, "-12:00");
tbuf=GWEN_Buffer_new(0, 32, 0, 1);
GWEN_Buffer_AppendString(tbuf, tmpl);
GWEN_Buffer_AppendString(tbuf, "-hh:mm");
ti=GWEN_Time_fromUtcString(GWEN_Buffer_GetStart(dbuf),
GWEN_Buffer_GetStart(tbuf));
GWEN_Buffer_free(tbuf);
GWEN_Buffer_free(dbuf);
}
else {
if (inUtc)
ti=GWEN_Time_fromUtcString(p, tmpl);
else
ti=GWEN_Time_fromString(p, tmpl);
}
return ti;
}
示例5: AB_Value_toHbciString
void AB_Value_toHbciString(const AB_VALUE *v, GWEN_BUFFER *buf) {
GWEN_BUFFER *tbuf;
char *p;
int l;
tbuf=GWEN_Buffer_new(0, 32, 0, 1);
AB_Value_toHumanReadableString2(v, tbuf, 2, 0);
/* convert decimal komma */
p=GWEN_Buffer_GetStart(tbuf);
while(*p) {
if (*p=='.') {
*p=',';
break;
}
p++;
}
/* remove trailing zeroes */
p=GWEN_Buffer_GetStart(tbuf);
l=strlen(GWEN_Buffer_GetStart(tbuf));
if (l>0 && strchr(p, ',')!=NULL) {
l--;
while(l>0 && p[l]=='0') {
p[l]=0;
l--;
}
}
GWEN_Buffer_AppendString(buf, GWEN_Buffer_GetStart(tbuf));
GWEN_Buffer_free(tbuf);
}
示例6: GWEN_PathManager_FindFile
int GWEN_PathManager_FindFile(const char *destLib,
const char *pathName,
const char *fileName,
GWEN_BUFFER *fbuf) {
GWEN_DB_NODE *dbT;
assert(gwen__paths);
dbT=GWEN_DB_GetGroup(gwen__paths, GWEN_PATH_FLAGS_NAMEMUSTEXIST,
destLib);
if (dbT) {
dbT=GWEN_DB_GetGroup(dbT, GWEN_PATH_FLAGS_NAMEMUSTEXIST,
pathName);
if (dbT) {
int i;
const char *s;
GWEN_DB_NODE *dbN;
GWEN_BUFFER *tbuf;
tbuf=GWEN_Buffer_new(0, 256, 0, 1);
/* check all paths */
dbN=GWEN_DB_FindFirstGroup(dbT, "pair");
while(dbN) {
for (i=0; ; i++) {
s=GWEN_DB_GetCharValue(dbN, "path", i, 0);
if (!s)
break;
else {
FILE *f;
GWEN_Buffer_AppendString(tbuf, s);
GWEN_Buffer_AppendString(tbuf, GWEN_DIR_SEPARATOR_S);
GWEN_Buffer_AppendString(tbuf, fileName);
DBG_DEBUG(GWEN_LOGDOMAIN, "Trying \"%s\"",
GWEN_Buffer_GetStart(tbuf));
f=fopen(GWEN_Buffer_GetStart(tbuf), "r");
if (f) {
fclose(f);
DBG_DEBUG(GWEN_LOGDOMAIN,
"File \"%s\" found in folder \"%s\"",
fileName,
s);
GWEN_Buffer_AppendBuffer(fbuf, tbuf);
GWEN_Buffer_free(tbuf);
return 0;
}
GWEN_Buffer_Reset(tbuf);
}
}
dbN=GWEN_DB_FindNextGroup(dbN, "pair");
}
GWEN_Buffer_free(tbuf);
}
}
DBG_INFO(GWEN_LOGDOMAIN, "File \"%s\" not found", fileName);
return GWEN_ERROR_NOT_FOUND;
}
示例7: LC_EgkCard_ReadRawPd
LC_CLIENT_RESULT LC_EgkCard_ReadRawPd(LC_CARD *card, GWEN_BUFFER *buf){
LC_EGKCARD *egk;
LC_CLIENT_RESULT res;
GWEN_BUFFER *lbuf;
int size;
const unsigned char *p;
assert(card);
egk=GWEN_INHERIT_GETDATA(LC_CARD, LC_EGKCARD, card);
assert(egk);
res=LC_Card_SelectEf(card, "EF_PD");
if (res!=LC_Client_ResultOk)
return res;
lbuf=GWEN_Buffer_new(0, 2, 0, 1);
res=LC_Card_IsoReadBinary(card, 0, 0, 2, lbuf);
if (res!=LC_Client_ResultOk) {
GWEN_Buffer_free(lbuf);
return res;
}
if (GWEN_Buffer_GetUsedBytes(lbuf)<2) {
DBG_ERROR(LC_LOGDOMAIN, "Invalid response size (%d)",
GWEN_Buffer_GetUsedBytes(lbuf));
GWEN_Buffer_free(lbuf);
return LC_Client_ResultDataError;
}
p=(const unsigned char*)GWEN_Buffer_GetStart(lbuf);
assert(p);
size=(*(p++))<<8;
size+=*p;
if (size<2) {
DBG_ERROR(LC_LOGDOMAIN, "Invalid size spec in data (%d)", size);
GWEN_Buffer_free(lbuf);
return LC_Client_ResultDataError;
}
size-=2;
GWEN_Buffer_Reset(lbuf);
if (size) {
res=LC_Card_ReadBinary(card, 2, size, lbuf);
if (res!=LC_Client_ResultOk) {
DBG_INFO(LC_LOGDOMAIN, "here (%d)", res);
GWEN_Buffer_free(lbuf);
return res;
}
}
res=LC_EgkCard_Unzip(GWEN_Buffer_GetStart(lbuf),
GWEN_Buffer_GetUsedBytes(lbuf),
buf);
GWEN_Buffer_free(lbuf);
return res;
}
示例8: _dumpBal
static
void _dumpBal(const AB_BALANCE *bal,
const GWEN_TIME *ti,
FILE *fd) {
if (bal) {
const GWEN_TIME *bti;
const AB_VALUE *val;
bti=AB_Balance_GetTime(bal);
if (bti==0)
bti=ti;
if (bti) {
GWEN_BUFFER *tbuf;
tbuf=GWEN_Buffer_new(0, 24, 0, 1);
GWEN_Time_toString(bti, "DD.MM.YYYY\thh:mm", tbuf);
fprintf(fd, "%s\t", GWEN_Buffer_GetStart(tbuf));
GWEN_Buffer_free(tbuf);
}
else {
fprintf(fd, "\t\t");
}
val=AB_Balance_GetValue(bal);
if (val) {
AB_VALUE *vNew;
GWEN_BUFFER *vbuf;
const char *cur;
vNew=AB_Value_dup(val);
AB_Value_SetCurrency(vNew, NULL);
vbuf=GWEN_Buffer_new(0, 32, 0, 1);
AB_Value_toHumanReadableString(vNew, vbuf, 2);
fprintf(fd, "%s\t", GWEN_Buffer_GetStart(vbuf));
GWEN_Buffer_free(vbuf);
AB_Value_free(vNew);
cur=AB_Value_GetCurrency(val);
if (cur)
fprintf(fd, "%s\t", cur);
else
fprintf(fd, "\t");
}
else {
fprintf(fd, "\t\t");
}
}
else {
fprintf(fd, "\t\t\t\t");
}
}
示例9: GWEN_PathManager_GetMatchingFilesRecursively
int GWEN_PathManager_GetMatchingFilesRecursively(const char *destLib,
const char *pathName,
const char *subFolderName,
GWEN_STRINGLIST *sl,
const char *mask) {
GWEN_DB_NODE *dbT;
assert(gwen__paths);
dbT=GWEN_DB_GetGroup(gwen__paths, GWEN_PATH_FLAGS_NAMEMUSTEXIST,
destLib);
if (dbT) {
dbT=GWEN_DB_GetGroup(dbT, GWEN_PATH_FLAGS_NAMEMUSTEXIST,
pathName);
if (dbT) {
int i;
const char *s;
GWEN_DB_NODE *dbN;
GWEN_BUFFER *tbuf;
tbuf=GWEN_Buffer_new(0, 256, 0, 1);
/* check all paths */
dbN=GWEN_DB_FindFirstGroup(dbT, "pair");
while(dbN) {
for (i=0; ; i++) {
s=GWEN_DB_GetCharValue(dbN, "path", i, 0);
if (!s)
break;
else {
GWEN_Buffer_AppendString(tbuf, s);
if (subFolderName && *subFolderName) {
GWEN_Buffer_AppendString(tbuf, GWEN_DIR_SEPARATOR_S);
GWEN_Buffer_AppendString(tbuf, subFolderName);
}
DBG_DEBUG(GWEN_LOGDOMAIN, "Trying \"%s\"",
GWEN_Buffer_GetStart(tbuf));
GWEN_Directory_GetMatchingFilesRecursively(GWEN_Buffer_GetStart(tbuf), sl, mask);
GWEN_Buffer_Reset(tbuf);
}
}
dbN=GWEN_DB_FindNextGroup(dbN, "pair");
}
GWEN_Buffer_free(tbuf);
}
}
return 0;
}
示例10: AIO_OfxGroup_STATUS_AddData
int AIO_OfxGroup_STATUS_AddData(AIO_OFX_GROUP *g, const char *data)
{
AIO_OFX_GROUP_STATUS *xg;
assert(g);
xg=GWEN_INHERIT_GETDATA(AIO_OFX_GROUP, AIO_OFX_GROUP_STATUS, g);
assert(xg);
if (xg->currentElement) {
GWEN_BUFFER *buf;
int rv;
const char *s;
buf=GWEN_Buffer_new(0, strlen(data), 0, 1);
rv=AIO_OfxXmlCtx_SanitizeData(AIO_OfxGroup_GetXmlContext(g), data, buf);
if (rv<0) {
DBG_INFO(AQBANKING_LOGDOMAIN, "here (%d)", rv);
GWEN_Buffer_free(buf);
return rv;
}
s=GWEN_Buffer_GetStart(buf);
if (*s) {
DBG_INFO(AQBANKING_LOGDOMAIN,
"AddData: %s=[%s]", xg->currentElement, s);
if (strcasecmp(xg->currentElement, "CODE")==0) {
if (1!=sscanf(s, "%d", &xg->code)) {
DBG_ERROR(AQBANKING_LOGDOMAIN,
"Bad data for element [%s]",
xg->currentElement);
GWEN_Buffer_free(buf);
return GWEN_ERROR_BAD_DATA;
}
}
else if (strcasecmp(xg->currentElement, "SEVERITY")==0) {
free(xg->severity);
xg->severity=strdup(GWEN_Buffer_GetStart(buf));
}
else {
DBG_INFO(AQBANKING_LOGDOMAIN,
"Ignoring data for unknown element [%s]",
xg->currentElement);
}
}
GWEN_Buffer_free(buf);
}
return 0;
}
示例11: GWEN_Padd_UnpaddWithIso9796_2
int GWEN_Padd_UnpaddWithIso9796_2(GWEN_BUFFER *buf) {
uint32_t l;
uint32_t realSize;
const uint8_t *p;
l=GWEN_Buffer_GetUsedBytes(buf);
if (l<11) {
DBG_ERROR(GWEN_LOGDOMAIN, "Buffer contains too few bytes");
return GWEN_ERROR_INVALID;
}
p=(const uint8_t*)GWEN_Buffer_GetStart(buf);
if (*p!=0x60) {
DBG_ERROR(GWEN_LOGDOMAIN, "First byte is not a 0x60");
return GWEN_ERROR_BAD_DATA;
}
p++;
l=0;
while(*p==0x00) {
l++;
p++;
}
if (*p!=0x01) {
/*DBG_ERROR(GWEN_LOGDOMAIN, "First byte after padding is not a 0x01");*/
return GWEN_ERROR_BAD_DATA;
}
realSize=GWEN_Buffer_GetUsedBytes(buf)-11-l;
GWEN_Buffer_Crop(buf, 10+l, realSize);
return 0;
}
示例12: Gtk3Gui_WLabel_SetCharProperty
static GWENHYWFAR_CB
int Gtk3Gui_WLabel_SetCharProperty(GWEN_WIDGET *w,
GWEN_DIALOG_PROPERTY prop,
int index,
const char *value,
int doSignal) {
GtkLabel *g;
GWEN_BUFFER *tbuf;
g=GTK_LABEL(GWEN_Widget_GetImplData(w, GTK3_DIALOG_WIDGET_REAL));
assert(g);
tbuf=GWEN_Buffer_new(0, 128, 0, 1);
if (value && *value)
Gtk3Gui_GetRawText(value, tbuf);
switch(prop) {
case GWEN_DialogProperty_Title:
gtk_label_set_text(g, GWEN_Buffer_GetStart(tbuf));
GWEN_Buffer_free(tbuf);
return 0;
default:
break;
}
DBG_WARN(GWEN_LOGDOMAIN,
"Function is not appropriate for this type of widget (%s)",
GWEN_Widget_Type_toString(GWEN_Widget_GetType(w)));
GWEN_Buffer_free(tbuf);
return GWEN_ERROR_INVALID;
}
示例13: Gtk3Gui_WLabel_Setup
static int Gtk3Gui_WLabel_Setup(GWEN_WIDGET *w) {
GtkWidget *g;
const char *s;
GWEN_WIDGET *wParent;
GWEN_BUFFER *tbuf;
wParent=GWEN_Widget_Tree_GetParent(w);
s=GWEN_Widget_GetText(w, 0);
tbuf=GWEN_Buffer_new(0, 128, 0, 1);
if (s && *s)
Gtk3Gui_GetRawText(s, tbuf);
g=gtk_label_new(GWEN_Buffer_GetStart(tbuf));
GWEN_Buffer_free(tbuf);
GWEN_Widget_SetImplData(w, GTK3_DIALOG_WIDGET_REAL, (void*) g);
GWEN_Widget_SetImplData(w, GTK3_DIALOG_WIDGET_CONTENT, (void*) g);
GWEN_Widget_SetSetIntPropertyFn(w, Gtk3Gui_WLabel_SetIntProperty);
GWEN_Widget_SetGetIntPropertyFn(w, Gtk3Gui_WLabel_GetIntProperty);
GWEN_Widget_SetSetCharPropertyFn(w, Gtk3Gui_WLabel_SetCharProperty);
GWEN_Widget_SetGetCharPropertyFn(w, Gtk3Gui_WLabel_GetCharProperty);
if (wParent)
GWEN_Widget_AddChildGuiWidget(wParent, w);
return 0;
}
示例14: AB_Banking_GetSharedDataDir
int AB_Banking_GetSharedDataDir(const AB_BANKING *ab,
const char *name,
GWEN_BUFFER *buf){
assert(ab);
if (ab->dataDir) {
GWEN_Buffer_AppendString(buf, ab->dataDir);
GWEN_Buffer_AppendString(buf, DIRSEP "shared" DIRSEP);
if (GWEN_Text_EscapeToBufferTolerant(name, buf)) {
DBG_ERROR(AQBANKING_LOGDOMAIN,
"Bad share name, aborting.");
abort();
}
else {
char *s;
s=GWEN_Buffer_GetStart(buf);
while(*s) {
*s=tolower(*s);
s++;
}
}
return 0;
}
else {
DBG_ERROR(AQBANKING_LOGDOMAIN, "No data dir (not init?)");
return GWEN_ERROR_GENERIC;
}
}
示例15: LC_EgkCard_ReadInsuranceData
LC_CLIENT_RESULT LC_EgkCard_ReadInsuranceData(LC_CARD *card,
LC_HI_INSURANCE_DATA **pData) {
GWEN_BUFFER *dbuf;
LC_CLIENT_RESULT res;
dbuf=GWEN_Buffer_new(0, 256, 0, 1);
res=LC_EgkCard_ReadVd(card, dbuf);
if (res!=LC_Client_ResultOk) {
DBG_INFO(LC_LOGDOMAIN, "here (%d)", res);
GWEN_Buffer_free(dbuf);
return res;
}
else {
GWEN_XMLNODE *root;
root=GWEN_XMLNode_fromString(GWEN_Buffer_GetStart(dbuf),
GWEN_Buffer_GetUsedBytes(dbuf),
GWEN_XML_FLAGS_HANDLE_HEADERS |
GWEN_XML_FLAGS_HANDLE_NAMESPACES);
if (root==NULL) {
DBG_INFO(LC_LOGDOMAIN, "Invalid XML string");
GWEN_Buffer_free(dbuf);
return LC_Client_ResultDataError;
}
GWEN_Buffer_free(dbuf);
GWEN_XMLNode_StripNamespaces(root);
res=LC_EgkCard_ParseInsuranceData(root, pData);
GWEN_XMLNode_free(root);
return res;
}
}