本文整理汇总了C++中CField::GetRecordName方法的典型用法代码示例。如果您正苦于以下问题:C++ CField::GetRecordName方法的具体用法?C++ CField::GetRecordName怎么用?C++ CField::GetRecordName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CField
的用法示例。
在下文中一共展示了CField::GetRecordName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetRecord
//----------------------------------------
wxString CFieldsTreeCtrl::GetRecord(const wxTreeItemId& id)
{
wxString recordName;
if (id.IsOk())
{
CField* field = GetField(id);
if (field != NULL)
{
recordName = field->GetRecordName().c_str();
}
if ((recordName.IsEmpty()) && (m_product->IsNetCdf()))
{
recordName = CProductNetCdf::m_virtualRecordName.c_str();
}
}
return recordName;
}
示例2: main
int main (int argc, char *argv[])
{
string FileName;
CStringArray InputFiles;
CProduct *Product = NULL;
bool Error = false;
bool Help = false;
if (argc != 2)
Error = true;
else if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0))
Help = true;
else
{
FileName.assign(argv[1]);
if (! CTools::FileExists(FileName))
{
cerr << "ERROR: Data file '" << FileName << "' not found" << endl << endl;
Error = true;
}
InputFiles.push_back(FileName);
}
if (Error || Help)
{
cerr << "Usage : " << argv[0] << " [ -h | --help] FileName" << endl;
cerr << "Where FileName is the name of a file to show" << endl;
}
if (Help)
cerr << endl << "Displays the fields available for a product file" << endl;
if (Error || Help)
return 2;
if (getenv(BRATHL_ENVVAR) == NULL)
{
CTools::SetDataDirForExecutable(argv[0]);
}
try
{
// auto_ptr<CTrace>pTrace(CTrace::GetInstance());
// construct the product
Product = CProduct::Construct(InputFiles);
Product->Open(FileName);
CTreeField *Tree = Product->GetTreeField();
if (Tree->GetRoot() != NULL)
{
Tree->SetWalkDownRootPivot();
do
{
CField *field = dynamic_cast<CField*>(Tree->GetWalkCurrent()->GetData());
if (field == NULL)
{
throw CException("ERROR at least one of the tree object is not a CField object",
BRATHL_INCONSISTENCY_ERROR);
}
if (typeid(*field) == typeid(CFieldRecord))
continue;
if ((typeid(*field) == typeid(CFieldArray)) &&
(! field->IsFixedSize()))
continue;
string Unit = field->GetUnit();
cout << CTools::Format("%-20s", field->GetRecordName().c_str())
<< field->GetFullName();
if (Unit != "")
cout << " (" << Unit << ")";
cout << endl;
}
while (Tree->SubTreeWalkDown());
}
delete Product;
return 0;
}
catch (CException &e)
{
cerr << "BRAT ERROR: " << e.what() << endl;
return 1;
}
catch (exception &e)
{
cerr << "BRAT RUNTIME ERROR: " << e.what() << endl;
return 254;
}
catch (...)
{
cerr << "BRAT FATAL ERROR: Unexpected error" << endl;
return 255;
}
}