当前位置: 首页>>代码示例>>C++>>正文


C++ copy_chars函数代码示例

本文整理汇总了C++中copy_chars函数的典型用法代码示例。如果您正苦于以下问题:C++ copy_chars函数的具体用法?C++ copy_chars怎么用?C++ copy_chars使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了copy_chars函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: print_element_node

        inline OutIt print_element_node(OutIt out, const xml_node<Ch> *node, int flags, int indent)
        {
            assert(node->type() == node_element);

            // Print element name and attributes, if any
            if (!(flags & print_no_indenting)) {
                //out = fill_chars(out, indent, Ch('\t'));
                out = fill_chars(out, indent, Ch(' '));
                out = fill_chars(out, indent, Ch(' '));
            }
            *out = Ch('<'), ++out;
            out = copy_chars(node->name(), node->name() + node->name_size(), out);
            out = print_attributes(out, node);
            
            // If node is childless
            if (node->value_size() == 0 && !node->first_node())
            {
                // Print childless node tag ending
                *out = Ch('/'), ++out;
                *out = Ch('>'), ++out;
            }
            else
            {
                // Print normal node tag ending
                *out = Ch('>'), ++out;

                // Test if node contains a single data node only (and no other nodes)
                xml_node<Ch> *child = node->first_node();
                if (!child)
                {
                    // If node has no children, only print its value without indenting
                    out = copy_and_expand_chars(node->value(), node->value() + node->value_size(), Ch(0), out);
                }
                else if (child->next_sibling() == 0 && child->type() == node_data)
                {
                    // If node has a sole data child, only print its value without indenting
                    out = copy_and_expand_chars(child->value(), child->value() + child->value_size(), Ch(0), out);
                }
                else
                {
                    // Print all children with full indenting
                    if (!(flags & print_no_indenting))
                        *out = Ch('\n'), ++out;
                    out = print_children(out, node, flags, indent + 1);
                    if (!(flags & print_no_indenting)) {
                        //out = fill_chars(out, indent, Ch('\t'));
                        out = fill_chars(out, indent, Ch(' '));
                        out = fill_chars(out, indent, Ch(' '));
                    }
                }

                // Print node end
                *out = Ch('<'), ++out;
                *out = Ch('/'), ++out;
                out = copy_chars(node->name(), node->name() + node->name_size(), out);
                *out = Ch('>'), ++out;
            }
            return out;
        }
开发者ID:OxfordSKA,项目名称:OSKAR,代码行数:59,代码来源:rapidxml_print.hpp

示例2: poss_macro_expand

void poss_macro_expand(TokenStream& tok, char*&q, char*& p)
{
  char temp_buff[TT_BUFFSIZE];
  char token[MAX_IDEN_SIZE];

  p = copy_token(p,token);
  // is it a macro?  Otherwise just copy out....                
  if (tok.macro_attempt_process(p,temp_buff,token))
     q = copy_chars(q,temp_buff);
  else
     q = copy_chars(q,token);
}
开发者ID:doniexun,项目名称:UnderC,代码行数:12,代码来源:subst.cpp

示例3: print_pi_node

 inline OutIt print_pi_node(OutIt out, const xml_node<Ch> *node, int flags, int indent)
 {
     assert(node->type() == node_pi);
     if (!(flags & print_no_indenting))
         out = fill_chars(out, indent, Ch('\t'));
     *out = Ch('<'), ++out;
     *out = Ch('?'), ++out;
     out = copy_chars(node->name(), node->name() + node->name_size(), out);
     *out = Ch(' '), ++out;
     out = copy_chars(node->value(), node->value() + node->value_size(), out);
     *out = Ch('?'), ++out;
     *out = Ch('>'), ++out;
     return out;
 }
开发者ID:gjianw217,项目名称:DLPRobot,代码行数:14,代码来源:rapidxml_print.hpp

示例4: print_attributes

 inline OutIt print_attributes(OutIt out, const xml_node<Ch> *node, int flags)
 {
     for (xml_attribute<Ch> *attribute = node->first_attribute(); attribute; attribute = attribute->next_attribute())
     {
         if (attribute->name() && attribute->value())
         {
             // Print attribute name
             *out = Ch(' '), ++out;
             out = copy_chars(attribute->name(), attribute->name() + attribute->name_size(), out);
             *out = Ch('='), ++out;
             // Print attribute value using appropriate quote type
             if (find_char<Ch, Ch('"')>(attribute->value(), attribute->value() + attribute->value_size()))
             {
                 *out = Ch('\''), ++out;
                 out = copy_and_expand_chars(attribute->value(), attribute->value() + attribute->value_size(), Ch('"'), out);
                 *out = Ch('\''), ++out;
             }
             else
             {
                 *out = Ch('"'), ++out;
                 out = copy_and_expand_chars(attribute->value(), attribute->value() + attribute->value_size(), Ch('\''), out);
                 *out = Ch('"'), ++out;
             }
         }
     }
     return out;
 }
开发者ID:gjianw217,项目名称:DLPRobot,代码行数:27,代码来源:rapidxml_print.hpp

示例5: move_chars

static inline void move_chars(struct part *p, int x, int y, int nx, int ny)
{
	if (LEN(y) - x <= 0) return;
	copy_chars(p, nx, ny, LEN(y) - x, &POS(x, y));
	SLEN(y, x);
	move_links(p, x, y, nx, ny);
}
开发者ID:ebichu,项目名称:dd-wrt,代码行数:7,代码来源:html_r.c

示例6: while

char *substitute(TokenStream& tok, char *buff, char **actual_args, char *subst)
 //----------------------------------------------------------------------------
 {
   char temp_buff[TT_BUFFSIZE],args_buff[STRSIZE];
   char *p = subst, *q = temp_buff;
   while (*p) {
      if (*p == ARG_MARKER) { // ie. 1..NARGS
        char *arg = actual_args[p[1]-1]; // get following (one-based) argument
        // stringize or token-pasting operator suppresses arg expansion
        // *fix 1.2.2a Token-pasting can operate the _other way_ of course!
        if (p > subst && (p[-1]=='#' || p[2]=='#')) { 
           bool stringize = p[-1] == '#' && (p-1 == subst || p[-2] != '#');           
           // the last char(s) were '#' - discard them!
           if (stringize) { q--; *q++ = '\"'; } 
           else if (p[-1]=='#')  q -= 2;
           // copy the substitution, without expanding the argument
           q = (stringize? stringify : copy_chars)(q,arg);
           if (stringize) *q++ = '\"';
           p += 2;  // skip the special marker _and_ the arg index
           // ignore '##' afterwards, unless it's followed by a parameter....
           if (p[0] == '#' && p[1] == '#' && p[2] != ARG_MARKER) p+= 2;
        }
        else { // must expand any arguments first!
         macro_substitute(tok,arg,args_buff);
         q = copy_chars(q,args_buff);
         p += 2;
        }  
      }
      else *q++ = *p++;
   }
   *q = '\0';
   macro_substitute(tok,temp_buff,buff);
   return buff;
 }
开发者ID:doniexun,项目名称:UnderC,代码行数:34,代码来源:subst.cpp

示例7: shift_chars

static inline void shift_chars(struct part *p, int y, int s)
{
	chr *a;
	int l = LEN(y);
	if ((unsigned)l > MAXINT / sizeof(chr)) overalloc();
	a = mem_alloc(l * sizeof(chr));
	memcpy(a, &POS(0, y), l * sizeof(chr));
	set_hchars(p, 0, y, s, (p->data->data[y].c << 11) | ' ');
	copy_chars(p, s, y, l, a);
	mem_free(a);
	move_links(p, 0, y, s, y);
}
开发者ID:ebichu,项目名称:dd-wrt,代码行数:12,代码来源:html_r.c

示例8: print_comment_node

 inline OutIt print_comment_node(OutIt out, const xml_node<Ch> *node, int flags, int indent)
 {
     assert(node->type() == node_comment);
     if (!(flags & print_no_indenting))
         out = fill_chars(out, indent << 1, Ch(RAPIDXML_IC));
     *out = Ch('<'), ++out;
     *out = Ch('!'), ++out;
     *out = Ch('-'), ++out;
     *out = Ch('-'), ++out;
     out = copy_chars(node->value(), node->value() + node->value_size(), out);
     *out = Ch('-'), ++out;
     *out = Ch('-'), ++out;
     *out = Ch('>'), ++out;
     return out;
 }
开发者ID:halx99,项目名称:xmldrv3,代码行数:15,代码来源:rapidxml_print.hpp

示例9: print_doctype_node

 inline OutIt print_doctype_node(OutIt out, const xml_node<Ch> *node, int flags, int indent)
 {
     assert(node->type() == node_doctype);
     if (!(flags & print_no_indenting))
         out = fill_chars(out, indent, Ch('\t'));
     *out = Ch('<'), ++out;
     *out = Ch('!'), ++out;
     *out = Ch('D'), ++out;
     *out = Ch('O'), ++out;
     *out = Ch('C'), ++out;
     *out = Ch('T'), ++out;
     *out = Ch('Y'), ++out;
     *out = Ch('P'), ++out;
     *out = Ch('E'), ++out;
     *out = Ch(' '), ++out;
     out = copy_chars(node->value(), node->value() + node->value_size(), out);
     *out = Ch('>'), ++out;
     return out;
 }
开发者ID:gjianw217,项目名称:DLPRobot,代码行数:19,代码来源:rapidxml_print.hpp

示例10: print_cdata_node

 inline OutIt print_cdata_node(OutIt out, const xml_node<Ch> *node, int flags, int indent)
 {
     assert(node->type() == node_cdata);
     if (!(flags & print_no_indenting))
         out = fill_chars(out, indent, Ch('\t'));
     *out = Ch('<'); ++out;
     *out = Ch('!'); ++out;
     *out = Ch('['); ++out;
     *out = Ch('C'); ++out;
     *out = Ch('D'); ++out;
     *out = Ch('A'); ++out;
     *out = Ch('T'); ++out;
     *out = Ch('A'); ++out;
     *out = Ch('['); ++out;
     out = copy_chars(node->value(), node->value() + node->value_size(), out);
     *out = Ch(']'); ++out;
     *out = Ch(']'); ++out;
     *out = Ch('>'); ++out;
     return out;
 }
开发者ID:gjianw217,项目名称:DLPRobot,代码行数:20,代码来源:rapidxml_print.hpp

示例11: print_node

                out = print_node(out, child, flags, indent);
            return out;
        }

        // Print attributes of the node
        template<class OutIt, class Ch>
        inline OutIt print_attributes(OutIt out, const xml_node<Ch> *node, int flags)
        {
			Q_UNUSED(flags)
            for (xml_attribute<Ch> *attribute = node->first_attribute(); attribute; attribute = attribute->next_attribute())
            {
                if (attribute->name() && attribute->value())
                {
                    // Print attribute name
                    *out = Ch(' '), ++out;
                    out = copy_chars(attribute->name(), attribute->name() + attribute->name_size(), out);
                    *out = Ch('='), ++out;
                    // Print attribute value using appropriate quote type
                    if (find_char<Ch, Ch('"')>(attribute->value(), attribute->value() + attribute->value_size()))
                    {
                        *out = Ch('\''), ++out;
                        out = copy_and_expand_chars(attribute->value(), attribute->value() + attribute->value_size(), Ch('"'), out);
                        *out = Ch('\''), ++out;
                    }
                    else
                    {
                        *out = Ch('"'), ++out;
                        out = copy_and_expand_chars(attribute->value(), attribute->value() + attribute->value_size(), Ch('\''), out);
                        *out = Ch('"'), ++out;
                    }
                }
开发者ID:kehlaaa,项目名称:TradeClient,代码行数:31,代码来源:rapidxml_print.hpp

示例12: copy_chars

// copy_string(): create a copy of a string on the specified heap. A
// pointer to the copy is returned.
char *copy_string(NAMemory *heap, const char *src)
{
  return copy_chars(heap, src, (src ? strlen(src) : 0), TRUE);
}
开发者ID:AlexPeng19,项目名称:incubator-trafodion,代码行数:6,代码来源:LmCommon.cpp


注:本文中的copy_chars函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。