• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ spaces函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: process

// calls either process_dir or process_file, above
static void process(const char *what, int level, int recursive,
                    char *overlapping_dems[], int *next_dem_number,
                    meta_parameters *meta, int *n_dems_total)
{
  struct stat stbuf;

  if (stat(what, &stbuf) == -1) {
    asfPrintStatus("  Cannot access: %s\n", what);
    return;
  }

  char *base = get_filename(what);

  if ((stbuf.st_mode & S_IFMT) == S_IFDIR) {
      if (level==0 || recursive) {
          asfPrintStatus("  %s%s/\n", spaces(level), base);
          process_dir(what, level+1, recursive, overlapping_dems,
              next_dem_number, meta, n_dems_total);
      }
      else {
          asfPrintStatus("  %s%s (skipped)\n", spaces(level), base);
      }
  }
  else {
      process_file(what, level, overlapping_dems, next_dem_number,
          meta, n_dems_total);
  }

  FREE(base);
}
开发者ID:glshort,项目名称:MapReady,代码行数:31,代码来源:build_dem.c


示例2: DumpType

static void DumpType(IDiaSymbol *symbol, int deep)
{
    IDiaEnumSymbols *   enumChilds = NULL;
    HRESULT             hr;
    const char *        nameStr = NULL;
    const char *        type;
    LONG                offset;
    ULONGLONG           length;
    ULONG               celt = 0;
    ULONG               symtag;
    DWORD               locType;
    bool                typeSeen;

#if 0
    if (deep > 2)
        return;
#endif

    if (symbol->get_symTag(&symtag) != S_OK)
        return;

    nameStr = GetTypeName(symbol);

    g_typesSeen.Intern(nameStr, &typeSeen);
    if (typeSeen)
        return;

    symbol->get_length(&length);
    symbol->get_offset(&offset);

    if (SymTagData == symtag) {
        if (symbol->get_locationType(&locType) != S_OK)
            return; // must be a symbol in optimized code

        // TODO: use get_offsetInUdt (http://msdn.microsoft.com/en-us/library/dd997149.aspx) ?
        // TODO: use get_type (http://msdn.microsoft.com/en-US/library/cwx3656b(v=vs.80).aspx) ?
        // TODO: see what else we can get http://msdn.microsoft.com/en-US/library/w8ae4k32(v=vs.80).aspx
        if (LocIsThisRel == locType) {
            g_report.AppendFmt("%s%s|%d\n", spaces(deep), nameStr, (int)offset);
        }
    } else if (SymTagUDT == symtag) {
        // TODO: why is it always "struct" even for classes?
        type = GetUdtType(symbol);
        g_report.AppendFmt("%s%s|%s|%d\n", spaces(deep), type, nameStr, (int)length);
        hr = symbol->findChildren(SymTagNull, NULL, nsNone, &enumChilds);
        if (!SUCCEEDED(hr))
            return;
        IDiaSymbol* child;
        while (SUCCEEDED(enumChilds->Next(1, &child, &celt)) && (celt == 1))
        {
            DumpType(child, deep+1);
            child->Release();
        }
        enumChilds->Release();
    } else {
        if (symbol->get_locationType(&locType) != S_OK)
            return; // must be a symbol in optimized code
        // TODO: assert?
    }
}
开发者ID:DavidWiberg,项目名称:sumatrapdf,代码行数:60,代码来源:main.cpp


示例3: spaces

void XmlWriter::write(const NodePtr nodeArg)
{
    NodePtr node = nodeArg;

    indent+=2;

    NamedNodeMap attributes = node->getAttributes();
    int nrAttrs = attributes.getLength();

    //### Start open tag
    spaces();
    po("<");
    pos(node->getNodeName());
    if (nrAttrs>0)
        po("\n");

    //### Attributes
    for (int i=0 ; i<nrAttrs ; i++)
        {
        NodePtr attr = attributes.item(i);
        spaces();
        pos(attr->getNodeName());
        po("=\"");
        pos(attr->getNodeValue());
        po("\"\n");
        }

    //### Finish open tag
    if (nrAttrs>0)
        spaces();
    po(">\n");

    //### Contents
    spaces();
    pos(node->getNodeValue());

    //### Children
    for (NodePtr child = node->getFirstChild() ;
         child.get() ;
         child=child->getNextSibling())
        {
        write(child);
        }

    //### Close tag
    spaces();
    po("</");
    pos(node->getNodeName());
    po(">\n");

    indent-=2;
}
开发者ID:Spin0za,项目名称:inkscape,代码行数:52,代码来源:xmlwriter.cpp


示例4: spaces

 void InfoVisitor::apply(osg::Geode& geode)
 {
     std::cout << spaces() << geode.libraryName() << "::" << geode.className() << std::endl;
     ++_level;
     osg::Drawable* drawable = nullptr;
     for (size_t i = 0; i < geode.getNumDrawables(); ++i)
     {
         drawable = geode.getDrawable(i);
         std::cout << spaces() << drawable->libraryName() << "::" << drawable->className() << std::endl;
     }
     traverse(geode);
     --_level;
 }
开发者ID:vwaurich,项目名称:OMVis,代码行数:13,代码来源:InfoVisiter.cpp


示例5: floorArea

 double Building_Impl::peoplePerFloorArea() const {
   double area = floorArea();
   double np = numberOfPeople();
   if (equal(area,0.0)) {
     if (equal(np,0.0)) {
       return 0.0;
     }
     if (spaces().size() == 1u) {
       return spaces()[0].peoplePerFloorArea();
     }
     LOG_AND_THROW("Calculation would require division by 0.");
   }
   return np / area;
 }
开发者ID:Anto-F,项目名称:OpenStudio,代码行数:14,代码来源:Building.cpp


示例6: airVolume

 double Building_Impl::infiltrationDesignAirChangesPerHour() const {
   double volume = airVolume();
   double idfr = infiltrationDesignFlowRate();
   if (equal(volume,0.0)) {
     if (equal(idfr,0.0)) {
       return 0.0;
     }
     if (spaces().size() == 1u) {
       return spaces()[0].infiltrationDesignAirChangesPerHour();
     }
     LOG_AND_THROW("Calculation would require division by 0.");
   }
   return convert(idfr/volume,"1/s","1/h").get();
 }
开发者ID:Anto-F,项目名称:OpenStudio,代码行数:14,代码来源:Building.cpp


示例7: world_free

void world_free(World *w){
	int i;	
	assert(w!=NULL);
	for(i=0; i<numobj(w);i++)
		object_free(obj(w)[i]);
	free(obj(w));
	for(i=0; i<numspaces(w);i++)
		space_free(spaces(w)[i]);
	player_free(player(w));
	free(spaces(w));
	free(w);

	return;
}
开发者ID:RodrigoDePool,项目名称:ProyProg,代码行数:14,代码来源:world.c


示例8: exteriorWallArea

 double Building_Impl::infiltrationDesignFlowPerExteriorWallArea() const {
   double area = exteriorWallArea();
   double idfr = infiltrationDesignFlowRate();
   if (equal(area,0.0)) {
     if (equal(idfr,0.0)) {
       return 0.0;
     }
     if (spaces().size() == 1u) {
       return spaces()[0].infiltrationDesignFlowPerExteriorWallArea();
     }
     LOG_AND_THROW("Calculation would require division by 0.");
   }
   return idfr/area;
 }
开发者ID:Anto-F,项目名称:OpenStudio,代码行数:14,代码来源:Building.cpp


示例9: numberOfPeople

 double Building_Impl::gasEquipmentPowerPerPerson() const {
   double np = numberOfPeople();
   double ep = gasEquipmentPower();
   if (equal(np,0.0)) {
     if (equal(ep,0.0)) {
       return 0.0;
     }
     if (spaces().size() == 1u) {
       return spaces()[0].gasEquipmentPowerPerPerson();
     }
     LOG_AND_THROW("Calculation would require division by 0.");
   }
   return ep / np;
 }
开发者ID:Anto-F,项目名称:OpenStudio,代码行数:14,代码来源:Building.cpp


示例10: gen_headings

void gen_headings( int width, int depth, int subh, char *alpha)
{
    char alphabet[100];
    int k, i;
    int count = 0;
    
    for (k = width - 1 ; k >= 0 ; k--)
    {
        count++;

        if (subh)
            sprintf(alphabet, "%s%i", alpha, ((width)- k));
        
        else
            sprintf(alphabet, "%s%c", alpha, ('a'-1) + ((width) - k ));
     
	printf("Section %s\n",alphabet);
	spaces(count);        
        if (depth == 0)
            return;
        else if ( depth != 0)
        {
            i = strlen(alphabet);
            alphabet[i] = '.';
            alphabet[i + 1] = '\0';
        }
    
    
    gen_headings(width, depth - 1, !subh,  alphabet);

    }
}
开发者ID:Dhrumil95,项目名称:AcademicProjects,代码行数:32,代码来源:outline.c


示例11: __error_gen_internal

std::string __error_gen_internal(const Location& loc, const std::string& msg, const char* type, bool context)
{
	std::string ret;

	auto colour = COLOUR_RED_BOLD;
	if(strcmp(type, "warning") == 0)
		colour = COLOUR_MAGENTA_BOLD;

	else if(strcmp(type, "note") == 0)
		colour = COLOUR_GREY_BOLD;

	// bool empty = strcmp(type, "") == 0;
	// bool dobold = strcmp(type, "note") != 0;

	//? do we want to truncate the file path?
	//? we're doing it now, might want to change (or use a flag)

	std::string filename = frontend::getFilenameFromPath(loc.fileID == 0 ? "(unknown)"
		: frontend::getFilenameFromID(loc.fileID));

	ret += strprintf("%s%s%s:%s %s\n", COLOUR_RESET, colour, type, COLOUR_RESET, msg);

	if(loc.fileID > 0)
	{
		auto location = strprintf("%s:%d:%d", filename, loc.line + 1, loc.col + 1);
		ret += strprintf("%s%sat:%s %s%s", COLOUR_RESET, COLOUR_GREY_BOLD, spaces(strlen(type) - 2), COLOUR_RESET, location);
	}

	ret += "\n";

	if(context && loc.fileID > 0)
		ret += getSingleContext(loc) + "\n";

	return ret;
}
开发者ID:flax-lang,项目名称:flax,代码行数:35,代码来源:errors.cpp


示例12: getch

void ConsoleInput::parse()
{
    if ( kbhit() )
    {
        char ch = getch();

        if( (int)ch == 13 && !mInputBuffer.empty() )
        {
            // Enter
            std::cout << "Lua: " << mInputBuffer << std::endl;
            mCommandCallback( mInputBuffer );
            String spaces( mInputBuffer.size(), ' ' );
            std::cout << spaces << "\r" << std::flush;
            mInputBuffer.clear();
        }
        else if( (int)ch == 8 && !mInputBuffer.empty() )
        {
            // Backspace
            mInputBuffer[ mInputBuffer.size() - 1 ] = ' ';
            std::cout << mInputBuffer << "\r" << std::flush;
            mInputBuffer.erase( mInputBuffer.size() - 1 );
        }
        else if( (int)ch >= 32 && (int)ch <= 126 )
        {
            // Normal input
            mInputBuffer.append( 1, ch );
        }

        std::cout << mInputBuffer << "\r" << std::flush;
    }
}
开发者ID:Gohla,项目名称:Diversia,代码行数:31,代码来源:ConsoleInput.cpp


示例13: result

 double Building_Impl::airVolume() const {
   double result(0.0);
   for (const Space& space : spaces()) {
     result += space.volume() * space.multiplier();
   }
   return result;
 }
开发者ID:Anto-F,项目名称:OpenStudio,代码行数:7,代码来源:Building.cpp


示例14: print_struct_def

int print_struct_def(struct struct_def *sdef, long long offset, char *data)
{
	struct struct_member *member; 
	struct type_info *tinfo;
	int end;

	if (sdef->type == TYPE_ENUM) {
		my_printf("0x%lx",*((int*)data));		
		return 4;
	}
	if (sdef->type != TYPE_STRUCTURE) return 0;	
	if (!sdef) {
		my_printf("Structure not found\n");
		return 0;
	}
	
	my_printf("\n");
	indent_struct(offset);
	my_printf("struct %s size=%d {\n", sdef->name, sdef->size);
	indent++;
	member = sdef->members;
	while(member != NULL) {
		indent_struct(member->offset + offset);
		col += my_printf("%s",member->name); spaces();
		tinfo = member->type;
		print_id(tinfo->id, offset + member->offset, data + (member->offset / 8));
		end = member->offset + offset + member->size;
		member = member->next;
		my_printf("\n");
	}
	indent--;
	indent_struct(end); my_printf("}");
	return sdef->size;
}
开发者ID:tushargosavi,项目名称:utils,代码行数:34,代码来源:struct_print.c


示例15: fetchContextLine

static std::string fetchContextLine(Location loc, size_t* adjust)
{
	if(loc.fileID == 0) return "";

	auto lines = frontend::getFileLines(loc.fileID);
	if(lines.size() > loc.line)
	{
		std::string orig = util::to_string(lines[loc.line]);
		std::stringstream ln;

		// skip all leading whitespace.
		bool ws = true;
		for(auto c : orig)
		{
			if(ws && c == '\t')                 { *adjust += TAB_WIDTH; continue;   }
			else if(ws && c == ' ')             { *adjust += 1; continue;           }
			else if(c == '\n')                  { break;                            }
			else                                { ws = false; ln << c;              }
		}

		return strprintf("%s%s", spaces(LEFT_PADDING), ln.str().c_str());
	}

	return "";
}
开发者ID:flax-lang,项目名称:flax,代码行数:25,代码来源:errors.cpp


示例16: max_n_digits_in_triangle

void PASCAL::print(){

	int offset = 1;

	int tot_n_rows = _triangle.size();
	int n_spaces = std::sqrt(3) * tot_n_rows / 2 + offset;
	int max_plaque_size = max_n_digits_in_triangle();
	
	
	std::cout << "nspaces = " << n_spaces << std::endl;
	std::cout << "tot_n_rows = " << tot_n_rows <<std::endl;
	std::cout << "max_n_digits_in_triangle = " << max_plaque_size << std::endl;


	for(int r = 0; r < tot_n_rows; r++){
		std::cout << spaces(n_spaces);
		for(int e = 0; e < _triangle[r].size(); e++){
			std::cout << _triangle[r][e] << " ";
			//std::cout << gen_plaque(max_plaque_size, _triangle[r][e]) << " ";
		}	
		std::cout << std::endl;
		n_spaces --;
	}

	clean();


}
开发者ID:jpoffline,项目名称:pascal_shp,代码行数:28,代码来源:PASCAL.cpp


示例17: mStarted

LLTemplateTokenizer::LLTemplateTokenizer(const std::string & contents) : mStarted(false), mTokens()
{
	boost::char_separator<char> newline("\r\n", "", boost::keep_empty_tokens);
	boost::char_separator<char> spaces(" \t");
	U32 line_counter = 1;
	
	tokenizer line_tokens(contents, newline);
	for(tokenizer::iterator line_iter = line_tokens.begin();
		line_iter != line_tokens.end();
		++line_iter, ++line_counter)
	{
		tokenizer word_tokens(*line_iter, spaces);
		for(tokenizer::iterator word_iter = word_tokens.begin();
			word_iter != word_tokens.end();
			++word_iter)
		{
			if((*word_iter)[0] == '/')
			{
				break;   // skip to end of line on comments
			}
			positioned_token pt;// = new positioned_token();
			pt.str = std::string(*word_iter);
			pt.line = line_counter;
			mTokens.push_back(pt);
		}
	}
	mCurrent = mTokens.begin();
}
开发者ID:OS-Development,项目名称:VW.Meerkat,代码行数:28,代码来源:llmessagetemplateparser.cpp


示例18: spaces

void TextBox::draw(sf::RenderTarget& w) {

    w.draw(sprite);

    sf::FloatRect totalSpace;
    totalSpace = sprite.getGlobalBounds();
    sf::Vector2f spaces( totalSpace.width/10, totalSpace.height/8);
    float yPos = totalSpace.top;

    for(int i = 0; i < int(boxTexts.size()); ++i) {

        text.setString(boxTexts[i]);

        text.setPosition(sprite.getPosition().x+spaces.x, yPos+spaces.y/2 );

        sf::Vector2f textSize(text.getLocalBounds().width, text.getLocalBounds().height);
        float oldSize = text.getCharacterSize();
        text.setCharacterSize(50);
        text.setScale(textSize.x/text.getLocalBounds().width, textSize.y/text.getLocalBounds().height);
        w.draw(text);
        text.setCharacterSize(oldSize);
        yPos += textSize.y;

    }

}
开发者ID:kaitokidi,项目名称:Base,代码行数:26,代码来源:TextBox.cpp


示例19: print_generic2

static void
print_generic2(const slang_operation *op, const char *oper,
               const char *s, int indent)
{
   GLuint i;
   if (oper) {
      spaces(indent);
      printf("%s %s at %p locals=%p outer=%p\n",
             oper, s, (void *) op, (void *) op->locals, 
             (void *) op->locals->outer_scope);
   }
   for (i = 0; i < op->num_children; i++) {
      spaces(indent);
      printf("//child %u of %u:\n", i, op->num_children);
      slang_print_tree(&op->children[i], indent);
   }
}
开发者ID:aljen,项目名称:haiku-opengl,代码行数:17,代码来源:slang_print.c


示例20: strlen

void
cli_ui_out::do_field_string (int fldno, int width, ui_align align,
			     const char *fldname, const char *string)
{
  int before = 0;
  int after = 0;

  if (m_suppress_output)
    return;

  if ((align != ui_noalign) && string)
    {
      before = width - strlen (string);
      if (before <= 0)
	before = 0;
      else
	{
	  if (align == ui_right)
	    after = 0;
	  else if (align == ui_left)
	    {
	      after = before;
	      before = 0;
	    }
	  else
	    /* ui_center */
	    {
	      after = before / 2;
	      before -= after;
	    }
	}
    }

  if (before)
    spaces (before);

  if (string)
    fputs_filtered (string, m_streams.back ());

  if (after)
    spaces (after);

  if (align != ui_noalign)
    field_separator ();
}
开发者ID:jon-turney,项目名称:binutils-gdb,代码行数:45,代码来源:cli-out.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ span_log函数代码示例发布时间:2022-05-30
下一篇:
C++ spaceinline函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap