本文整理汇总了C++中Qstring函数的典型用法代码示例。如果您正苦于以下问题:C++ Qstring函数的具体用法?C++ Qstring怎么用?C++ Qstring使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Qstring函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: definitionlist
static void
definitionlist(Paragraph *p, MMIOT *f)
{
Line *tag;
if ( p ) {
Qstring("<dl>\n", f);
for ( ; p ; p = p->next) {
for ( tag = p->text; tag; tag = tag->next ) {
Qstring("<dt>", f);
___mkd_reparse(T(tag->text), S(tag->text), 0, f);
Qstring("</dt>\n", f);
}
// MK HACK
if (p->down) {
p->down->easyNewline = p->easyNewline;
}
htmlify(p->down, "dd", p->ident, f);
Qchar('\n', f);
}
Qstring("</dl>", f);
}
}
开发者ID:panicsteve,项目名称:trunkdesk,代码行数:25,代码来源:generate.c
示例2: splat
static int
splat(Line *p, char *block, Istring align, int force, MMIOT *f)
{
int first,
idx = 0,
colno = 0;
Qstring("<tr>\n", f);
while ( idx < S(p->text) ) {
first = idx;
if ( force && (colno >= S(align)-1) )
idx = S(p->text);
else
while ( (idx < S(p->text)) && (T(p->text)[idx] != '|') )
++idx;
Qprintf(f, "<%s%s>",
block,
alignments[ (colno < S(align)) ? T(align)[colno]:0 ]);
___mkd_reparse(T(p->text)+first, idx-first, 0, f);
Qprintf(f, "</%s>\n", block);
idx++;
colno++;
}
if ( force )
while (colno < S(align) ) {
Qprintf(f, "<%s></%s>\n", block, block);
++colno;
}
Qstring("</tr>\n", f);
return colno;
}
开发者ID:gensym,项目名称:markdownlive,代码行数:32,代码来源:generate.c
示例3: printlinkyref
/* print out the start of an `img' or `a' tag, applying callbacks as needed.
*/
static void
printlinkyref(MMIOT *f, linkytype *tag, char *link, int size)
{
char *edit;
if ( f->flags & IS_LABEL )
return;
Qstring(tag->link_pfx, f);
if ( tag->kind & IS_URL ) {
if ( f->cb && f->cb->e_url && (edit = (*f->cb->e_url)(link, size, f->cb->e_data)) ) {
puturl(edit, strlen(edit), f, 0);
if ( f->cb->e_free ) (*f->cb->e_free)(edit, f->cb->e_data);
}
else
puturl(link + tag->szpat, size - tag->szpat, f, 0);
}
else
___mkd_reparse(link + tag->szpat, size - tag->szpat, MKD_TAGTEXT, f, 0);
Qstring(tag->link_sfx, f);
if ( f->cb && f->cb->e_flags && (edit = (*f->cb->e_flags)(link, size, f->cb->e_data)) ) {
Qchar(' ', f);
Qstring(edit, f);
if ( f->cb->e_free ) (*f->cb->e_free)(edit, f->cb->e_data);
}
} /* printlinkyref */
开发者ID:BossKing10010,项目名称:appledoc,代码行数:31,代码来源:generate.c
示例4: delspan
/* delspan() -- write out a chunk of text, blocking with <del>...</del>
*/
static void
delspan(MMIOT *f, int size)
{
Qstring("<del>", f);
___mkd_reparse(cursor(f)-1, size, 0, f);
Qstring("</del>", f);
}
开发者ID:panicsteve,项目名称:trunkdesk,代码行数:9,代码来源:generate.c
示例5: printblock
static int
printblock(Paragraph *pp, MMIOT *f)
{
Line *t = pp->text;
static char *Begin[] = { "", "<p>", "<center>" };
static char *End[] = { "", "</p>","</center>" };
while (t) {
if ( S(t->text) ) {
if ( S(t->text) > 2 && T(t->text)[S(t->text)-2] == ' '
&& T(t->text)[S(t->text)-1] == ' ') {
push(T(t->text), S(t->text)-2, f);
push("\003\n", 2, f);
}
else {
___mkd_tidy(&t->text);
push(T(t->text), S(t->text), f);
if ( t->next )
push("\n", 1, f);
}
}
t = t->next;
}
Qstring(Begin[pp->align], f);
text(f);
Qstring(End[pp->align], f);
return 1;
}
开发者ID:gensym,项目名称:markdownlive,代码行数:28,代码来源:generate.c
示例6: puturl
/*
* write out a url, escaping problematic characters
*/
static void
puturl(char *s, int size, MMIOT *f, int display)
{
unsigned char c;
while ( size-- > 0 ) {
c = *s++;
if ( c == '\\' && size-- > 0 ) {
c = *s++;
if ( !( ispunct(c) || isspace(c) ) )
Qchar('\\', f);
}
if ( c == '&' )
Qstring("&", f);
else if ( c == '<' )
Qstring("<", f);
else if ( c == '"' )
Qstring("%22", f);
else if ( isalnum(c) || ispunct(c) || (display && isspace(c)) )
Qchar(c, f);
else
Qprintf(f, "%%%02X", c);
}
}
开发者ID:gensym,项目名称:markdownlive,代码行数:30,代码来源:generate.c
示例7: printblock
static int
printblock(Paragraph *pp, MMIOT *f, int easyNewLine)
{
Line *t = pp->text;
static char *Begin[] = { "", "<p>", "<p style=\"text-align:center;\">" };
static char *End[] = { "", "</p>","</p>" };
while (t) {
if ( S(t->text) ) {
if ( t->next && S(t->text) > 2
&& T(t->text)[S(t->text)-2] == ' '
&& T(t->text)[S(t->text)-1] == ' ' ) {
push(T(t->text), S(t->text)-2, f);
push("\003\n", 2, f);
}
else {
___mkd_tidy(&t->text);
push(T(t->text), S(t->text), f);
/* MK NEWLINE HACK */
if ( t->next )
if (easyNewLine) {
push("\003\n", 2, f);
} else {
// Original
push("\n", 1, f);
}
}
}
t = t->next;
}
Qstring(Begin[pp->align], f);
text(f);
Qstring(End[pp->align], f);
return 1;
}
开发者ID:panicsteve,项目名称:trunkdesk,代码行数:35,代码来源:generate.c
示例8: linkyformat
/* print out a linky (or fail if it's Not Allowed)
*/
static int
linkyformat(MMIOT *f, Cstring text, int image, Footnote *ref)
{
linkytype *tag;
if ( image )
tag = &imaget;
else if ( tag = pseudo(ref->link) ) {
if ( f->flags & (NO_PSEUDO_PROTO|SAFELINK) )
return 0;
}
else if ( (f->flags & SAFELINK) && T(ref->link)
&& (T(ref->link)[0] != '/')
&& !isautoprefix(T(ref->link)) )
/* if SAFELINK, only accept links that are local or
* a well-known protocol
*/
return 0;
else
tag = &linkt;
if ( f->flags & tag->flags )
return 0;
if ( tag->link_pfx ) {
Qstring(tag->link_pfx, f);
if ( tag->kind & IS_URL ) {
if ( f->base && T(ref->link) && (T(ref->link)[tag->szpat] == '/') )
puturl(f->base, strlen(f->base), f, 0);
puturl(T(ref->link) + tag->szpat, S(ref->link) - tag->szpat, f, 0);
}
else
___mkd_reparse(T(ref->link) + tag->szpat, S(ref->link) - tag->szpat, INSIDE_TAG, f);
Qstring(tag->link_sfx, f);
if ( tag->WxH && ref->height && ref->width ) {
Qprintf(f," height=\"%d\"", ref->height);
Qprintf(f, " width=\"%d\"", ref->width);
}
if ( S(ref->title) ) {
Qstring(" title=\"", f);
___mkd_reparse(T(ref->title), S(ref->title), INSIDE_TAG, f);
Qchar('"', f);
}
Qstring(tag->text_pfx, f);
___mkd_reparse(T(text), S(text), tag->flags, f);
Qstring(tag->text_sfx, f);
}
else
Qwrite(T(ref->link) + tag->szpat, S(ref->link) - tag->szpat, f);
return 1;
} /* linkyformat */
开发者ID:gensym,项目名称:markdownlive,代码行数:59,代码来源:generate.c
示例9: cputc
/* write a character to output, doing text escapes ( & -> &,
* > -> > < -> < )
*/
static void
cputc(int c, MMIOT *f)
{
switch (c) {
case '&': Qstring("&", f); break;
case '>': Qstring(">", f); break;
case '<': Qstring("<", f); break;
default : Qchar(c, f); break;
}
}
开发者ID:gensym,项目名称:markdownlive,代码行数:13,代码来源:generate.c
示例10: codespan
/* codespan() -- write out a chunk of text as code, trimming one
* space off the front and/or back as appropriate.
*/
static void
codespan(MMIOT *f, int size)
{
int i=0, c;
if ( size > 1 && peek(f, size-1) == ' ' ) --size;
if ( peek(f,i) == ' ' ) ++i, --size;
Qstring("<code>", f);
code(f, cursor(f)+(i-1), size);
Qstring("</code>", f);
} /* codespan */
开发者ID:pixeltrix,项目名称:rdiscount,代码行数:15,代码来源:generate.c
示例11: linkyformat
/* print out a linky (or fail if it's Not Allowed)
*/
static int
linkyformat(MMIOT *f, Cstring text, int image, Footnote *ref)
{
linkytype *tag;
if ( image )
tag = &imaget;
else if ( tag = pseudo(ref->link) ) {
if ( f->flags & (MKD_NO_EXT|MKD_SAFELINK) )
return 0;
}
else if ( (f->flags & MKD_SAFELINK) && T(ref->link)
&& (T(ref->link)[0] != '/')
&& !isautoprefix(T(ref->link), S(ref->link)) )
/* if MKD_SAFELINK, only accept links that are local or
* a well-known protocol
*/
return 0;
else
tag = &linkt;
if ( f->flags & tag->flags )
return 0;
if ( f->flags & IS_LABEL )
___mkd_reparse(T(text), S(text), tag->flags, f);
else if ( tag->link_pfx ) {
printlinkyref(f, tag, T(ref->link), S(ref->link));
if ( tag->WxH ) {
if ( ref->height ) Qprintf(f," height=\"%d\"", ref->height);
if ( ref->width ) Qprintf(f, " width=\"%d\"", ref->width);
}
if ( S(ref->title) ) {
Qstring(" title=\"", f);
___mkd_reparse(T(ref->title), S(ref->title), MKD_TAGTEXT, f);
Qchar('"', f);
}
Qstring(tag->text_pfx, f);
___mkd_reparse(T(text), S(text), tag->flags, f);
Qstring(tag->text_sfx, f);
}
else
Qwrite(T(ref->link) + tag->szpat, S(ref->link) - tag->szpat, f);
return 1;
} /* linkyformat */
开发者ID:panicsteve,项目名称:trunkdesk,代码行数:51,代码来源:generate.c
示例12: linkylinky
/*
* process embedded links and images
*/
static int
linkylinky(int image, MMIOT *f)
{
int start = mmiottell(f);
Footnote link;
linkytype *tag;
if ( !linkykey(image, &link, f) ) {
mmiotseek(f, start);
return 0;
}
if ( image )
tag = &imaget;
else if ( (f->flags & NO_PSEUDO_PROTO) || (tag = extratag(link.link)) == 0 )
tag = &linkt;
if ( f->flags & tag-> flags ) {
mmiotseek(f, start);
return 0;
}
if ( tag->link_pfx ) {
Qstring(tag->link_pfx, f);
if ( f->base && (T(link.link)[tag->szpat] == '/') )
puturl(f->base, strlen(f->base), f);
puturl(T(link.link) + tag->szpat, S(link.link) - tag->szpat, f);
Qstring(tag->link_sfx, f);
if ( tag->WxH && link.height && link.width ) {
Qprintf(f," height=\"%d\"", link.height);
Qprintf(f, " width=\"%d\"", link.width);
}
if ( S(link.title) ) {
Qstring(" title=\"", f);
reparse(T(link.title), S(link.title), INSIDE_TAG, f);
Qchar('"', f);
}
Qstring(tag->text_pfx, f);
reparse(T(link.tag), S(link.tag), tag->flags, f);
Qstring(tag->text_sfx, f);
}
else
Qwrite(T(link.link) + tag->szpat, S(link.link) - tag->szpat, f);
return 1;
}
开发者ID:LuaDist,项目名称:lua-discount,代码行数:52,代码来源:generate.c
示例13: smartypants
/* Smarty-pants-style chrome for quotes, -, ellipses, and (r)(c)(tm)
*/
static int
smartypants(int c, int *flags, MMIOT *f)
{
int i;
if ( f->flags & (DENY_SMARTY|INSIDE_TAG) )
return 0;
for ( i=0; i < NRSMART; i++)
if ( (c == smarties[i].c0) && islike(f, smarties[i].pat) ) {
if ( smarties[i].entity )
Qprintf(f, "&%s;", smarties[i].entity);
shift(f, smarties[i].shift);
return 1;
}
switch (c) {
case '<' : return 0;
case '\'': if ( smartyquote(flags, 's', f) ) return 1;
break;
case '"': if ( smartyquote(flags, 'd', f) ) return 1;
break;
case '`': if ( peek(f, 1) == '`' ) {
int j = 2;
while ( (c=peek(f,j)) != EOF ) {
if ( c == '\\' )
j += 2;
else if ( c == '`' )
break;
else if ( c == '\'' && peek(f, j+1) == '\'' ) {
Qstring("“", f);
___mkd_reparse(cursor(f)+1, j-2, 0, f);
Qstring("”", f);
shift(f,j+1);
return 1;
}
else ++j;
}
}
break;
}
return 0;
} /* smartypants */
开发者ID:gensym,项目名称:markdownlive,代码行数:49,代码来源:generate.c
示例14: mangle
/*
* convert an email address to a string of nonsense
*/
static void
mangle(char *s, int len, MMIOT *f)
{
while ( len-- > 0 ) {
Qstring("&#", f);
Qprintf(f, COINTOSS() ? "x%02x;" : "%02d;", *((unsigned char*)(s++)) );
}
}
开发者ID:gensym,项目名称:markdownlive,代码行数:11,代码来源:generate.c
示例15: puturl
/*
* write out a url, escaping problematic characters
*/
static void
puturl(char *s, int size, MMIOT *f)
{
unsigned char c;
while ( size-- > 0 ) {
c = *s++;
if ( c == '&' )
Qstring("&", f);
else if ( c == '<' )
Qstring("<", f);
else if ( isalnum(c) || ispunct(c) )
Qchar(c, f);
else
Qprintf(f, "%%%02X", c);
}
}
开发者ID:gilesbowkett,项目名称:rdiscount,代码行数:21,代码来源:generate.c
示例16: display
/* dump out a Paragraph in the desired manner
*/
static Paragraph*
display(Paragraph *p, MMIOT *f)
{
if ( !p ) return 0;
switch ( p->typ ) {
case STYLE:
case WHITESPACE:
break;
case HTML:
printhtml(p->text, f);
break;
case CODE:
printcode(p->text, f);
break;
case QUOTE:
htmlify(p->down, p->ident ? "div" : "blockquote", p->ident, f);
break;
case UL:
case OL:
case AL:
listdisplay(p->typ, p->down, f);
break;
#if DL_TAG_EXTENSION
case DL:
definitionlist(p->down, f);
break;
#endif
case HR:
Qstring("<hr />", f);
break;
case HDR:
printheader(p, f);
break;
case TABLE:
printtable(p, f);
break;
case SOURCE:
htmlify(p->down, 0, 0, f);
break;
default:
printblock(p, f);
break;
}
return p->next;
}
开发者ID:gensym,项目名称:markdownlive,代码行数:58,代码来源:generate.c
示例17: printcode
static void
printcode(Line *t, MMIOT *f)
{
int blanks;
Qstring("<pre><code>", f);
for ( blanks = 0; t ; t = t->next ) {
if ( S(t->text) > t->dle ) {
while ( blanks ) {
Qchar('\n', f);
--blanks;
}
code(f, T(t->text), S(t->text));
Qchar('\n', f);
}
else blanks++;
}
Qstring("</code></pre>", f);
}
开发者ID:pixeltrix,项目名称:rdiscount,代码行数:19,代码来源:generate.c
示例18: Qprintf
/* Qprintf()
*/
static void
Qprintf(MMIOT *f, char *fmt, ...)
{
char bfr[80];
va_list ptr;
va_start(ptr,fmt);
vsnprintf(bfr, sizeof bfr, fmt, ptr);
va_end(ptr);
Qstring(bfr, f);
}
开发者ID:gensym,项目名称:markdownlive,代码行数:13,代码来源:generate.c
示例19: printcode
static void
printcode(Line *t, MMIOT *f)
{
int blanks;
for ( blanks = 0; t ; t = t->next )
if ( S(t->text) > t->dle ) {
while ( blanks ) {
push("\n", 1, f);
--blanks;
}
push(T(t->text), S(t->text), f);
push("\n", 1, f);
}
else blanks++;
Qstring("<pre><code>", f);
code(0, f);
Qstring("</code></pre>", f);
}
开发者ID:gensym,项目名称:markdownlive,代码行数:20,代码来源:generate.c
示例20: code
/* code() -- write a string out as code. The only characters that have
* special meaning in a code block are * `<' and `&' , which
* are /always/ expanded to < and &
*/
static void
code(MMIOT *f, char *s, int length)
{
int i,c;
for ( i=0; i < length; i++ )
if ( (c = s[i]) == 003) /* ^C: expand back to 2 spaces */
Qstring(" ", f);
else
cputc(c, f);
} /* code */
开发者ID:pixeltrix,项目名称:rdiscount,代码行数:15,代码来源:generate.c
注:本文中的Qstring函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论