;
68 virtual void Init(
void);
69 virtual int Run(
void);
73 voidSetup(
const CArgs& args);
76 voidProcessOneFile(
const string& current_file);
77 boolProcessOneDirectory(
const CDir& directory,
const CMask&
mask,
boolrecurse);
105m_LogStream(0), m_output(0),
106m_comma_separated(
false),
107m_no_header(
false),
108m_skip_empty(
false),
109m_ignore_unknown_types(
false)
112 #ifdef NCBI_PRODUCTION_VER 130arg_desc->AddOptionalKey
131(
"p",
"Directory",
"Path to input files",
134arg_desc->AddOptionalKey
135(
"r",
"Directory",
"Path to results",
138arg_desc->AddOptionalKey
139(
"i",
"InFile",
"Single Input File",
142arg_desc->AddOptionalKey(
143 "o",
"OutFile",
"Single Output File",
146arg_desc->AddDefaultKey
149arg_desc->AddFlag(
"E",
"Recurse");
151arg_desc->AddFlag(
"no-header",
"Start from the first row");
152arg_desc->AddFlag(
"skip-empty",
"Ignore all empty rows");
153arg_desc->AddFlag(
"ignore-unknown",
"Ignore all unknown types");
154arg_desc->AddDefaultKey(
"format",
"String",
"Output type: tab, xml, text, html",
CArgDescriptions::eString,
"tab");
156arg_desc->AddFlag(
"comma",
"Use comma separator instead of tabs");
160arg_desc->AddOptionalKey(
"required",
"String",
"Comma separated required columns, use indices or names",
CArgDescriptions::eString);
162arg_desc->AddOptionalKey(
"ignore",
"String",
"Comma separated columns to be ignored, use indices or names",
CArgDescriptions::eString);
164arg_desc->AddOptionalKey(
"unique",
"String",
165 "Comma separated columns needs to be unique in file, use indices or names",
170arg_desc->AddOptionalKey(
"discouraged",
"String",
"Comma separated list of discouraged types",
CArgDescriptions::eString);
176arg_desc->AddFlag(
"print-supported",
"Show supported data types");
179 stringprog_description =
"Validates tab delimited files against ASN.1 data types\n";
180arg_desc->SetUsageContext(GetArguments().GetProgramBasename(),
181prog_description,
false);
184SetupArgDescriptions(arg_desc.release());
206 if(args[
"print-supported"])
213 if(args[
"columns"])
218 if(args[
"required"])
224 if(args[
"ignore"])
229 if(args[
"unique"])
238 m_format= args[
"format"].AsString();
241 if(args[
"discouraged"])
247 if(args[
"require-one"])
255 m_output= &args[
"o"].AsOutputFile();
271 if(!outputdir.
Exists())
280 CDirdirectory(args[
"p"].AsString());
284masks.
Add(
"*"+args[
"x"].AsString());
298 "", 0,
"",
"",
"",
357 if(!
file.Exists())
361 "File "+ current_file +
" does not exists"));
366unique_ptr<CNcbiOfstream> local_output;
374 stringtemp_file = current_file.substr(0, current_file.rfind(
'.'));
375temp_file +=
".val";
376local_file.
Reset(temp_file);
378 output= local_output.get();
394 if(local_output.get())
405unique_ptr<CDir::TEntries>
entries(e);
407 for(CDir::TEntries::const_iterator it = e->begin(); it != e->end(); it++)
412 if(
mask.Match((*it)->GetPath()))
448 int main(
intargc,
const char* argv[])
ncbi::TMaskedQueryRegions mask
void PrintSupported(CNcbiOstream &out_stream) const
static CColumnValidatorRegistry & GetInstance()
static CLineError * Create(EProblem eProblem, EDiagSev eSeverity, const std::string &strSeqId, unsigned int uLine, const std::string &strFeatureName=string(""), const std::string &strQualifierName=string(""), const std::string &strQualifierValue=string(""), const std::string &strErrorMessage=string(""), const TVecOfLines &vecOfOtherLines=TVecOfLines())
Use this because the constructor is protected.
virtual void SetProgressOstream(CNcbiOstream *pProgressOstrm, ENcbiOwnership eNcbiOwnership=eNoOwnership)
This sets the stream to which progress messages are written.
size_t LevelCount(EDiagSev eSev) override
Returns the number of errors seen so far at the given severity.
size_t Count() const override
CNcbiOstream * m_LogStream
void ProcessOneFile(CNcbiIstream &input, CNcbiOstream *output)
void Setup(const CArgs &args)
CRef< CMessageListenerBase > m_logger
CArgValue::TStringArray m_require_one
string m_ResultsDirectory
bool m_ignore_unknown_types
bool ProcessOneDirectory(const CDir &directory, const CMask &mask, bool recurse)
static void RegisterAliases(CNcbiIstream *in_stream)
void ValidateInput(ILineReader &reader, const string &default_columns, const string &required, const string &ignored, const string &unique, const string &discouraged, const vector< string > &require_one)
@ e_tab_ignore_unknown_types
@ e_tab_ignore_empty_rows
void GenerateOutput(CNcbiOstream *out_stream, bool no_headers)
virtual bool PutError(const ILineError &)=0
Store error in the container, and return true if error was stored fine, and return false if the calle...
@ eProblem_GeneralParsingError
Include a standard set of the NCBI C++ Toolkit most basic headers.
static SQLCHAR output[256]
vector< string > TStringArray
Some values types can contain several value lists.
@ fAllowMultiple
Repeated key arguments are legal (use with AddKey)
@ eInputFile
Name of file (must exist and be readable)
@ eString
An arbitrary string.
@ eOutputFile
Name of file (must be writable)
@ eDS_Default
Try standard log file (app.name + ".log") in /log/, use stderr on failure.
@ eDiag_Error
Error message.
@ eDiag_Warning
Warning message.
@ eDiag_Fatal
Fatal error â guarantees exit(or abort)
@ eDiag_Critical
Critical error message.
const string & GetMsg(void) const
Get message string.
virtual bool Remove(TRemoveFlags flags=eRecursive) const
Remove a directory entry.
static string AddTrailingPathSeparator(const string &path)
Add trailing path separator, if needed.
virtual bool Exists(void) const
Check if directory "dirname" exists.
void Reset(const string &path)
Reset path string.
bool Create(TCreateFlags flags=fCreate_Default) const
Create the directory using "dirname" passed in the constructor.
TEntries * GetEntriesPtr(const string &mask=kEmptyStr, TGetEntriesFlags flags=0) const
Get directory entries based on the specified "mask".
const string & GetPath(void) const
Get entry path.
@ fIgnoreRecursive
Suppress "self recursive" elements (the directories "." and "..").
@ fCreateObjects
Create appropriate subclasses of CDirEntry (CFile,CDir,...), not just CDirEntry objects.
static CRef< ILineReader > New(const string &filename)
Return a new ILineReader object corresponding to the given filename, taking "-" (but not "....
void Reset(void)
Reset reference object.
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
static string & ToLower(string &str)
Convert string to lower case â string& version.
void Run(void)
Enter the main loop.
LOG LOG_cxx2c(void)
Create LOG on top of C++ Toolkit CNcbiDiag.
void CORE_SetREG(REG rg)
Set the registry (no registry if "rg" is passed zero) â to be used by the core internals.
REG REG_cxx2c(IRWRegistry *reg, bool pass_ownership=false)
Convert a C++ Toolkit registry object to a REG registry.
void CORE_SetLOG(LOG lg)
Set the log handle (no logging if "lg" is passed zero) â to be used by the core internals (CORE LOG).
void Add(const string &mask)
Add an inclusion mask.
Lightweight interface for getting lines of data with minimal memory copying.
Magic spell ;-) needed for some weird compilers... very empiric.
Classes to match a string against a set of masks.
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
#define GetArgs
Avoid preprocessor name clash with the NCBI C Toolkit.
Defines command line argument related classes.
Defines unified interface to application:
NCBI C++ stream class wrappers for triggering between "new" and "old" C++ stream libraries.
int main(int argc, const char *argv[])
const char * TABLEVAL_APP_VER
static wxAcceleratorEntry entries[3]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4