本文整理汇总了C++中KVString::IsWhitespace方法的典型用法代码示例。如果您正苦于以下问题:C++ KVString::IsWhitespace方法的具体用法?C++ KVString::IsWhitespace怎么用?C++ KVString::IsWhitespace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KVString
的用法示例。
在下文中一共展示了KVString::IsWhitespace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadPredefinedMaterials
void KVRangeYanez::ReadPredefinedMaterials(const Char_t* filename)
{
// Read materials from file whose name is given
TString DataFilePath = filename;
ifstream filestream;
if (!SearchAndOpenKVFile(DataFilePath, filestream, "data")) {
Error("ReadPredefinedMaterials", "Cannot open %s for reading", DataFilePath.Data());
return;
}
Info("ReadPredefinedMaterials", "Reading materials in file : %s", filename);
Bool_t compound, mixture;
compound = mixture = kFALSE;
KVString line;
while (filestream.good()) {
line.ReadLine(filestream);
if (filestream.good()) {
if (line.BeginsWith("//")) continue;
if (line.BeginsWith("COMPOUND")) {
compound = kTRUE;
mixture = kFALSE;
} else if (line.BeginsWith("MIXTURE")) {
compound = kFALSE;
mixture = kTRUE;
}
if (compound || mixture) {
// new compound or mixed material
KVString name, symbol, state;
Double_t density = -1;
KVString element[10];
Int_t natoms[10];
Int_t z[10], a[10];
Double_t proportion[10];
Int_t nelem = 0;
line.ReadLine(filestream);
while (filestream.good() && !line.IsWhitespace() && line != "\n") {
line.Begin("=");
KVString next = line.Next();
if (next == "name") name = line.Next();
else if (next == "symbol") symbol = line.Next();
else if (next == "state") state = line.Next();
else if (next == "density") density = line.Next().Atof();
else if (next == "nelem") {
nelem = line.Next().Atoi();
for (int i = 0; i < nelem; i++) {
line.ReadLine(filestream);
line.Begin(" ");
element[i] = line.Next();
a[i] = KVNucleus::IsMassGiven(element[i]);
KVNucleus n(element[i]);
z[i] = n.GetZ();
if (!a[i]) a[i] = TMath::Nint(n.GetNaturalA());
natoms[i] = line.Next().Atoi();
if (mixture) proportion[i] = line.Next().Atof();
}
}
line.ReadLine(filestream, kFALSE); //do not skip 'whitespace'
}
if (compound) AddCompoundMaterial(name, symbol, nelem, z, a, natoms, density);
else if (mixture) AddMixedMaterial(name, symbol, nelem, z, a, natoms, proportion, density);
compound = mixture = kFALSE;
}
}
}
}