@@ -40,17 +40,24 @@ inline char* p_strdup(CStr p) noexcept {
4040
4141struct Info {
4242 string name_, absName_;
43+ string type_;
4344 size_t size_ = 0 ;
45+ int64_t numLines_ = 0 ;
46+ int64_t numWords_ = 0 ;
47+ int64_t maxLlen_ = 0 ;
48+ int64_t numTextChars_ = 0 ;
49+
4450 bool exists_ = false ;
4551 bool accessible_ = false ;
4652 bool absolute_ = false ;
4753
4854public:
4955 Info () noexcept = default ;
56+ explicit Info (CStr nm) noexcept ;
57+ explicit Info (const string& nm) noexcept ;
5058
51- Info (CStr nm) noexcept ;
52- Info (const string& nm) noexcept ;
5359 void init () noexcept ;
60+ void inval () noexcept ;
5461
5562 static string get_abs_name (const string& nm) noexcept ;
5663 static string get_realpath (const string& nm) noexcept ;
@@ -215,9 +222,9 @@ class MMapReader : public Fio
215222public:
216223 MMapReader () noexcept = default ;
217224
218- MMapReader (CStr nm) noexcept : Fio(nm) {}
225+ explicit MMapReader (CStr nm) noexcept : Fio(nm) {}
219226
220- MMapReader (const string& nm) noexcept : Fio(nm) {}
227+ explicit MMapReader (const string& nm) noexcept : Fio(nm) {}
221228
222229 virtual ~MMapReader ();
223230
@@ -242,7 +249,7 @@ class MMapReader : public Fio
242249 }
243250
244251 int64_t countWC (int64_t & numWords) const noexcept ; // ~ wc command
245- int64_t printWC (std::ostream& os) const noexcept ; // ~ wc command
252+ int64_t printWC (std::ostream& os, Info* inf = nullptr ) const noexcept ;
246253
247254 size_t printLines (std::ostream& os) noexcept ;
248255 int64_t writeFile (const string& nm) noexcept ;
@@ -257,9 +264,9 @@ class MMapReader : public Fio
257264 int dprint1 () const noexcept ;
258265 int dprint2 () const noexcept ;
259266
260- private:
261- bool is_text_file (string& label) const noexcept ;
267+ bool is_text_file (Info& typeRet, bool scan = false ) const noexcept ;
262268
269+ private:
263270 vector<char *> get_backslashed_block (size_t fromLine) noexcept ;
264271
265272}; // MMapReader
@@ -276,9 +283,9 @@ struct LineReader : public Fio
276283 size_t cap_ = lr_DEFAULT_CAP;
277284
278285public:
279- LineReader (size_t iniCap = 0 ) noexcept ;
280- LineReader (CStr nm, size_t iniCap = 0 ) noexcept ;
281- LineReader (const string& nm, size_t iniCap = 0 ) noexcept ;
286+ explicit LineReader (size_t iniCap = 0 ) noexcept ;
287+ explicit LineReader (CStr nm, size_t iniCap = 0 ) noexcept ;
288+ explicit LineReader (const string& nm, size_t iniCap = 0 ) noexcept ;
282289
283290 virtual ~LineReader () { p_free (buf_); }
284291
@@ -349,7 +356,7 @@ class CSV_Reader : public MMapReader
349356
350357 CSV_Reader (CStr nm) noexcept : MMapReader(nm) {}
351358
352- CSV_Reader (const string& nm) noexcept : MMapReader(nm) {}
359+ explicit CSV_Reader (const string& nm) noexcept : MMapReader(nm) {}
353360
354361 virtual ~CSV_Reader ();
355362
@@ -437,8 +444,8 @@ class XML_Reader : public MMapReader
437444
438445public:
439446 XML_Reader () noexcept ;
440- XML_Reader (CStr nm) noexcept ;
441- XML_Reader (const string& nm) noexcept ;
447+ explicit XML_Reader (CStr nm) noexcept ;
448+ explicit XML_Reader (const string& nm) noexcept ;
442449
443450 virtual ~XML_Reader ();
444451
@@ -463,9 +470,6 @@ class XML_Reader : public MMapReader
463470
464471bool addIncludeGuards (LineReader& lr) noexcept ;
465472
466- inline bool c_is_digit (char c) noexcept { return uint32_t (c) - ' 0' < 10u ; }
467- inline bool c_is_dot_digit (char c) noexcept { return uint32_t (c) - ' 0' < 10u or c == ' .' ; }
468-
469473inline bool has_digit (CStr z) noexcept {
470474 if (!z || !z[0 ]) return false ;
471475
0 commit comments