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


C++ StringT类代码示例

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


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

示例1: OpenFile

void TextInputT::ReadGlobalElementMap (const StringT& name, iArrayT& elemmap)
{
  ifstreamT geo;
  OpenFile (geo, ".geo");

  StringT s;
  int numelms;
  char line [255];
  if (!AdvanceToBlock (geo, name, "Connectivities") ||
      !geo.FindString ("Number of elements", s) ||
      !s.Tail ('=', numelms)) throw ExceptionT::kDatabaseFail;
  if (elemmap.Length() != numelms) throw ExceptionT::kSizeMismatch;

	/* advance to the start of the connectivity block */
	if (!geo.FindString("index", s)) throw ExceptionT::kDatabaseFail;
	
	/* read map */
	elemmap = 0;
	for (int i=0; i < numelms; i++)
	{
		int index;
		geo >> index >> elemmap[i];
		geo.getline (line, 254);
    }
}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:25,代码来源:TextInputT.cpp

示例2: GetIterationInfo

/* collect global and local iterations info for each time step */
void MRSSKStV::GetIterationInfo(bool get_iters, int loc_iters)
{
	if(get_iters) {
		
		/* write data */
		const StringT& input_file = fSSMatSupport->InputFile();
	
		/* output filenames */
		StringT iterdata;
		iterdata.Root(input_file);
	
		iterdata.Append(".iterdata.", fSSMatSupport->StepNumber());
		
		/* open output streams */
		ofstreamT out_idata(iterdata);

		/* write */
		out_idata << "Time step number:       " << setw(kIntWidth) 
		          << fSSMatSupport->StepNumber() << endl;
		out_idata << "Global iteration number:" << setw(kIntWidth) 
		          << fSSMatSupport->GroupIterationNumber() << endl;
		out_idata << "Number of local iterations to converge:" << setw(kIntWidth) 
		          << loc_iters << endl;
		out_idata.close(); /* close */
		
	} // if(get_iters)
}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:28,代码来源:MRSSKStV.cpp

示例3: if

void NodeManagerPrimitive::RegisterOutput (OutputBaseT& output, MakeCSE_IOManager& input)
{
  // FUTURE: carry over node tags
  fOutputNodeMap.Dimension (fCoordinates.MajorDim());
  fOutputNodeMap.SetValueToPosition ();
  fOutputNodeMap ++;

  output.SetCoordinates (fCoordinates, &fOutputNodeMap);

  sArrayT blocktonodesets;
  input.BlockToNode (blocktonodesets);

  int nsetid = 1;
  
  for (int g=0; g < fNodeSetID.Length(); g++)
    if  (nsetid < atoi (fNodeSetID[g])) 
      nsetid = atoi (fNodeSetID[g]) + 1;

  iArrayT nodes;
  for (int i=0; i < blocktonodesets.Length(); i++)
    {
      StringT name;
      name.Append (nsetid + 1);
      out  << "\n Creating Node Set from Element Group ID . . . . = "
	   << blocktonodesets[i] << '\n';
      theBoss->NodesUsed (blocktonodesets[i], nodes);
      if (nodes.Length() > 0)
	AddNodeSet (name, nodes, CSEConstants::kSplit);
      else
	out << "\n     No nodes found...\n";
    }

  for (int n=0; n < fNodeSetData.Length(); n++)
    output.AddNodeSet (fNodeSetData[n], fNodeSetID[n]);
}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:35,代码来源:NodeManagerPrimitive.cpp

示例4: read_s

void
read_s(
	StringT& str,
	void const* data,
	std::size_t const size
) {
	duct::IO::StreamContext ctx(FromU::id, duct::Endian::system);
	duct::IO::imemstream stream(data, size * FromU::char_size);
	std::printf(
		"stream size: %lu\n",
		static_cast<unsigned long>(duct::IO::size(stream))
	);
	DUCT_ASSERTE(stream.good());
	ctx.read_string(
		stream, str, static_cast<std::streamsize>(size), duct::CHAR_NULL
	);
	DUCT_ASSERTE(stream.good());
	print_states(stream);
	std::printf(
		"String [size: %lu bsize: %lu len: %lu]: |",
		static_cast<unsigned long>(size),
		static_cast<unsigned long>(size*FromU::char_size),
		static_cast<unsigned long>(str.size())
	);
	std::cout << str << "|\n";
	str.clear();
}
开发者ID:komiga,项目名称:duct-cpp,代码行数:27,代码来源:string.cpp

示例5: FileName

/* generate database file name for the given ID */
void ExodusOutputT::FileName(int ID, StringT& filename) const
{
	/* root */
	filename = fOutroot;

	/* tack on sequence number */
	if (fSequence > 0) filename.Append(".sq", fSequence + 1);

	/* group number */
	//filename.Append(".gp", fElementSets[ID]->ID());
	//NOTE: it's hard to resolve the number of element groups from the
	//      number of io groups based solely on what's in the database,
	//      so skip it for now.	

	/* I/O ID */
	filename.Append(".io", ID);

	/* changing geometry */
	if (fElementSets[ID]->Changing())
		filename.Append(".ps", fElementSets[ID]->PrintStep(), 4);
			/* assuming no more than 1000 output steps */

	/* extension */
	filename.Append(".exo");
}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:26,代码来源:ExodusOutputT.cpp

示例6:

/* operator support */
ifstreamT& PartitionT::Read(ifstreamT& in)
{
	/* set comment marker */
	char old_marker = in.comment_marker();
	in.set_marker(CommentMarker());

	/* check version */
	StringT version;
	in >> version;
	if (version != sPartitionTVersion)
		ExceptionT::BadInputValue("operator>>PartitionT", 
			"file version %s is not the current %s", version.Pointer(), sPartitionTVersion);

	in >> fNumPartitions; // number of parts
	in >> fID;            // partition number
	in >> fScope;         // numbering scope
	in >> fDecompType;    // decomposition type

	int length;

	// read grid parameters for spatial decomposition
	if (fDecompType == PartitionT::kSpatial) {
		in >> length;
		fGridDims.Dimension(length);
		in >> fGridDims;
		fGridPosition.Dimension(length);
		in >> fGridPosition;
	}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:29,代码来源:PartitionT.cpp

示例7: var

StringT ParaDynOutputT::CreateFileName (const StringT& Label) const
{
  StringT var (fOutroot);
  
  /* tack on extension */
  var.Append (".");
  var.Append (Label);
  return var;
}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:9,代码来源:ParaDynOutputT.cpp

示例8: add_dir_sep

void add_dir_sep(StringT& str)
{
    if (
        str.IsEmpty() ||
        (str[str.GetLength() - 1] != tdir_sep::value)
    )
    {
        str += tdir_sep::value;
    }
}
开发者ID:svn2github,项目名称:p-stade,代码行数:10,代码来源:add_dir_sep.hpp

示例9: CompiledFunction

	Value * Compiler::lookup (Symbol * identifier) {
		StringT functionName = identifier->value();
		
		llvm::Function* code = m_engine->FindFunctionNamed(functionName.c_str());
		
		if (!code) {
			return NULL;
		}
		
		return new CompiledFunction(code);
	}
开发者ID:cppguy,项目名称:kai,代码行数:11,代码来源:Compiler.cpp

示例10: Save

void __stdcall BlackConfigurator::Save(const StringT& filename)
{
    FILE* fp = NULL;    
    if (_tfopen_s(&fp, filename.c_str(), _T("wb+, ccs=UTF-8")) != 0) {
        SXLOG_INF(g_local_logger) << _X(" open file for write failed! filepath:") << filename.c_str() << LBT << END;
        return;
    }
    ConfItemDictFileWriter writer(this, fp, 0);
    writer.Write();
    fclose(fp);
}
开发者ID:scofieldzhu,项目名称:blackconfigurator,代码行数:11,代码来源:black-configurator.cpp

示例11: generate_scalar_swap

void generate_scalar_swap(StringT & source, std::string const & numeric_string)
{
  source.append("__kernel void swap( \n");
  source.append("          __global "); source.append(numeric_string); source.append(" * s1, \n");
  source.append("          __global "); source.append(numeric_string); source.append(" * s2) \n");
  source.append("{ \n");
  source.append("  "); source.append(numeric_string); source.append(" tmp = *s2; \n");
  source.append("  *s2 = *s1; \n");
  source.append("  *s1 = tmp; \n");
  source.append("} \n");
}
开发者ID:10imaging,项目名称:viennacl,代码行数:11,代码来源:scalar.hpp

示例12: unescape_string

		StringT unescape_string (const StringT & value) {
			StringStreamT buffer;
			
			StringT::const_iterator i = value.begin(), end = value.end();
			
			// Skip enclosing quotes
			++i;
			--end;
			
			for (; i < end; ++i) {
				if (*i == '\\') {
					++i;
					
					switch (*i) {
						case 't':
							buffer << '\t';
							continue;
						case 'r':
							buffer << '\r';
							continue;
						case 'n':
							buffer << '\n';
							continue;
						case '\\':
							buffer << '\\';
							continue;
						case '"':
							buffer << '"';
							continue;
						case '\'':
							buffer << '\'';
							continue;
						case 'x':
							if ((end - i) >= 2) {
								StringT::value_type value = Math::convert_to_digit(*(++i)) << 4;
								value |= Math::convert_to_digit(*(++i));
								buffer << (StringT::value_type)value;
								continue;
							} else {
								break;
							}
						case '.':
							continue;
					}
					
					throw std::runtime_error("Could not parse string escape!");
				} else {
					buffer << *i;
				}
			}
		
			return buffer.str();
		}
开发者ID:ioquatix,项目名称:kai,代码行数:53,代码来源:Strings.cpp

示例13: parse_constant

		Token parse_constant(StringIteratorT begin, StringIteratorT end, const StringT & constant) {
			StringIteratorT s = begin;
			StringIteratorT c = constant.begin();
			
			while (s != end && c != constant.end() && *c == *s) s++, c++;
			
			if (c == constant.end()) {
				return Token(begin, s);
			} else {
				return Token();
			}
		}
开发者ID:ioquatix,项目名称:kai,代码行数:12,代码来源:Token.cpp

示例14: Load

bool __stdcall BlackConfigurator::Load(const StringT& filename)
{
    //Clear();
    FILE* fp = NULL;
    if (_tfopen_s(&fp, filename.c_str(), _T("rb+, ccs=UTF-8")) != 0) {
        SXLOG_INF(g_local_logger) << _X(" open file for read failed! filepath:") << filename.c_str() << LBT << END;
        return false;
    }
    ConfItemDictFileReader reader(fp);
    ConfItemDict* result_dict = reader.Read();
    return false;
}
开发者ID:scofieldzhu,项目名称:blackconfigurator,代码行数:12,代码来源:black-configurator.cpp

示例15: file

bool TextInputT::OpenFile (ifstreamT& in, const char* ext) const
{
  StringT file (fFileRoot);
  file.Append (ext);
  in.open (file);
  if (!in.is_open()) 
    {
      fout << "\nTextInputT::OpenFile unable to open " << file << "\n\n";
      return false;
    }
  return true;
}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:12,代码来源:TextInputT.cpp


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