
  Demonstating RegExHelper
 ==========================
  Command Line: ../RegExHelper/RegExHelper.h #include.*? 
  Analyzing ../RegExHelper/RegExHelper.h
  regexp: "#include.?>"

     1 "#pragma once"
       -- did not match RegEx: "#include.?>"
     2 "/////////////////////////////////////////////////////////////////////"
       -- did not match RegEx: "#include.?>"
     3 "// RegExHelper.h - Utility class for Regular Expressions           //"
       -- did not match RegEx: "#include.?>"
     4 "// ver 1.0                                                         //"
       -- did not match RegEx: "#include.?>"
     5 "// Jim Fawcett, CSE687 - Object Oriented Design, Fall 2018         //"
       -- did not match RegEx: "#include.?>"
     6 "/////////////////////////////////////////////////////////////////////"
       -- did not match RegEx: "#include.?>"
     7 "/*"
       -- did not match RegEx: "#include.?>"
     8 "*  Package Operations:"
       -- did not match RegEx: "#include.?>"
     9 "*  -------------------"
       -- did not match RegEx: "#include.?>"
    10 "*  Reads lines from source stream and applies a regular expression to each."
       -- did not match RegEx: "#include.?>"
    11 "*  Reports matches and returns a collection of lines from the source with"
       -- did not match RegEx: "#include.?>"
    12 "*  matching line, the matched text, and line number."
       -- did not match RegEx: "#include.?>"
    13 "*"
       -- did not match RegEx: "#include.?>"
    14 "*  Note: RegExHelper accepts regular expression strings on the command line."
       -- did not match RegEx: "#include.?>"
    15 "*  If the expression contains an '<' character, run without debugging in"
       -- did not match RegEx: "#include.?>"
    16 "*  Visual Studio will crash, while run with debugging works as expected."
       -- did not match RegEx: "#include.?>"
    17 "*  This is a problem with the console Visual Studio uses for run without"
       -- did not match RegEx: "#include.?>"
    18 "*  debugging."
       -- did not match RegEx: "#include.?>"
    19 "*"
       -- did not match RegEx: "#include.?>"
    20 "*  Required Files:"
       -- did not match RegEx: "#include.?>"
    21 "*  ---------------"
       -- did not match RegEx: "#include.?>"
    22 "*  RegExHelper.h, RegExHelper.cpp  // applications only need header"
       -- did not match RegEx: "#include.?>"
    23 "*"
       -- did not match RegEx: "#include.?>"
    24 "*  Maintenance History:"
       -- did not match RegEx: "#include.?>"
    25 "*  --------------------"
       -- did not match RegEx: "#include.?>"
    26 "*  ver 1.0 : 14 Aug 2018"
       -- did not match RegEx: "#include.?>"
    27 "*  - first release"
       -- did not match RegEx: "#include.?>"
    28 "*"
       -- did not match RegEx: "#include.?>"
    29 "*/"
       -- did not match RegEx: "#include.?>"
    30 ""
       -- did not match RegEx: "#include.?>"
    31 "#include <regex>"
       -- did not match RegEx: "#include.?>"
    32 "#include <vector>"
       -- did not match RegEx: "#include.?>"
    33 "#include <string>"
       -- did not match RegEx: "#include.?>"
    34 "#include <iostream>"
       -- did not match RegEx: "#include.?>"
    35 "#include <fstream>"
       -- did not match RegEx: "#include.?>"
    36 "#include <sstream>"
       -- did not match RegEx: "#include.?>"
    37 "#include <memory>"
       -- did not match RegEx: "#include.?>"
    38 "#include <tuple>"
       -- did not match RegEx: "#include.?>"
    39 ""
       -- did not match RegEx: "#include.?>"
    40 "namespace RegExUtilities"
       -- did not match RegEx: "#include.?>"
    41 "{"
       -- did not match RegEx: "#include.?>"
    42 "  // aliases used to increase readability of code"
       -- did not match RegEx: "#include.?>"
    43 ""
       -- did not match RegEx: "#include.?>"
    44 "  using Line = std::string;"
       -- did not match RegEx: "#include.?>"
    45 "  using MatchString = std::string;"
       -- did not match RegEx: "#include.?>"
    46 "  using Matches = bool;"
       -- did not match RegEx: "#include.?>"
    47 "  using LineCount = size_t;"
       -- did not match RegEx: "#include.?>"
    48 "  using MatchLine = std::tuple<Line, MatchString, LineCount, Matches>;"
       -- did not match RegEx: "#include.?>"
    49 "  using MatchLines = std::vector<MatchLine>;"
       -- did not match RegEx: "#include.?>"
    50 "  using iterator = std::vector<MatchLine>::iterator;"
       -- did not match RegEx: "#include.?>"
    51 "  using srcStreamPtr = std::shared_ptr<std::istream>;"
       -- did not match RegEx: "#include.?>"
    52 ""
       -- did not match RegEx: "#include.?>"
    53 "  enum MatchLineTypes { line = 0, matchString = 1, lineCount = 2, matches = 3 };"
       -- did not match RegEx: "#include.?>"
    54 ""
       -- did not match RegEx: "#include.?>"
    55 "  ///////////////////////////////////////////////////////////////////"
       -- did not match RegEx: "#include.?>"
    56 "  // RegExHelper class searches for matches in lines of text"
       -- did not match RegEx: "#include.?>"
    57 "  // - extracts lines from source and looks for match in each"
       -- did not match RegEx: "#include.?>"
    58 ""
       -- did not match RegEx: "#include.?>"
    59 "  class RegExHelper"
       -- did not match RegEx: "#include.?>"
    60 "  {"
       -- did not match RegEx: "#include.?>"
    61 "  public:"
       -- did not match RegEx: "#include.?>"
    62 "    RegExHelper(const std::string& re);"
       -- did not match RegEx: "#include.?>"
    63 "    void regExp(const std::string& regex);"
       -- did not match RegEx: "#include.?>"
    64 "    void showOnlyMatchingLines(bool soml = true);"
       -- did not match RegEx: "#include.?>"
    65 "    bool onlyMatchingLines();"
       -- did not match RegEx: "#include.?>"
    66 "    bool addSource(srcStreamPtr in);"
       -- did not match RegEx: "#include.?>"
    67 "    bool makeFileStreamSrc(const std::string& filename);"
       -- did not match RegEx: "#include.?>"
    68 "    bool makeStringStreamSrc(const std::string& text);"
       -- did not match RegEx: "#include.?>"
    69 "    bool search();"
       -- did not match RegEx: "#include.?>"
    70 "    MatchLine& operator[](size_t n);"
       -- did not match RegEx: "#include.?>"
    71 "    MatchLine operator[](size_t n) const;"
       -- did not match RegEx: "#include.?>"
    72 "    iterator begin();"
       -- did not match RegEx: "#include.?>"
    73 "    iterator end();"
       -- did not match RegEx: "#include.?>"
    74 "    size_t size();"
       -- did not match RegEx: "#include.?>"
    75 "  private:"
       -- did not match RegEx: "#include.?>"
    76 "    Line getLine();"
       -- did not match RegEx: "#include.?>"
    77 "    MatchLines srcLines_;"
       -- did not match RegEx: "#include.?>"
    78 "    srcStreamPtr src_;"
       -- did not match RegEx: "#include.?>"
    79 "    std::regex regex_;"
       -- did not match RegEx: "#include.?>"
    80 "    bool showOnlyMatchingLines_ = false;"
       -- did not match RegEx: "#include.?>"
    81 "  };"
       -- did not match RegEx: "#include.?>"
    82 ""
       -- did not match RegEx: "#include.?>"
    83 "  //----< creates instance, saving a regular expression, internally"
       -- did not match RegEx: "#include.?>"
    84 ""
       -- did not match RegEx: "#include.?>"
    85 "  inline RegExHelper::RegExHelper(const std::string& re) : regex_(re) {};"
       -- did not match RegEx: "#include.?>"
    86 ""
       -- did not match RegEx: "#include.?>"
    87 "  //----< accept new regular expression text >-----------------------"
       -- did not match RegEx: "#include.?>"
    88 ""
       -- did not match RegEx: "#include.?>"
    89 "  void RegExHelper::regExp(const std::string& regexp)"
       -- did not match RegEx: "#include.?>"
    90 "  {"
       -- did not match RegEx: "#include.?>"
    91 "    regex_ = regexp;"
       -- did not match RegEx: "#include.?>"
    92 "  }"
       -- did not match RegEx: "#include.?>"
    93 "  //----< set show only matching lines >-----------------------------"
       -- did not match RegEx: "#include.?>"
    94 ""
       -- did not match RegEx: "#include.?>"
    95 "  void RegExHelper::showOnlyMatchingLines(bool soml)"
       -- did not match RegEx: "#include.?>"
    96 "  {"
       -- did not match RegEx: "#include.?>"
    97 "    showOnlyMatchingLines_ = soml;"
       -- did not match RegEx: "#include.?>"
    98 "  }"
       -- did not match RegEx: "#include.?>"
    99 "  //----< show only matching lines? >--------------------------------"
       -- did not match RegEx: "#include.?>"
   100 ""
       -- did not match RegEx: "#include.?>"
   101 "  bool RegExHelper::onlyMatchingLines()"
       -- did not match RegEx: "#include.?>"
   102 "  {"
       -- did not match RegEx: "#include.?>"
   103 "    return showOnlyMatchingLines_;"
       -- did not match RegEx: "#include.?>"
   104 "  }"
       -- did not match RegEx: "#include.?>"
   105 "  //----< takes stream reference from using code >-------------------"
       -- did not match RegEx: "#include.?>"
   106 "  /*"
       -- did not match RegEx: "#include.?>"
   107 "  *  typical invocation: addSource(new std::ifstream(filename));"
       -- did not match RegEx: "#include.?>"
   108 "  */"
       -- did not match RegEx: "#include.?>"
   109 "  inline bool RegExHelper::addSource(srcStreamPtr in)"
       -- did not match RegEx: "#include.?>"
   110 "  {"
       -- did not match RegEx: "#include.?>"
   111 "    src_ = in;"
       -- did not match RegEx: "#include.?>"
   112 "    if (!src_->good())"
       -- did not match RegEx: "#include.?>"
   113 "      return false;"
       -- did not match RegEx: "#include.?>"
   114 "    return true;"
       -- did not match RegEx: "#include.?>"
   115 "  }"
       -- did not match RegEx: "#include.?>"
   116 "  //----< stores std::ifstream pointer derived from filename >-------"
       -- did not match RegEx: "#include.?>"
   117 ""
       -- did not match RegEx: "#include.?>"
   118 "  inline bool RegExHelper::makeFileStreamSrc(const std::string& filename)"
       -- did not match RegEx: "#include.?>"
   119 "  {"
       -- did not match RegEx: "#include.?>"
   120 "    std::ifstream* sPtr = new std::ifstream(filename);"
       -- did not match RegEx: "#include.?>"
   121 "    if (sPtr->good())"
       -- did not match RegEx: "#include.?>"
   122 "    {"
       -- did not match RegEx: "#include.?>"
   123 "      src_ = srcStreamPtr(sPtr);  // wrap C++ raw ptr in std::shared_ptr"
       -- did not match RegEx: "#include.?>"
   124 "      return true;"
       -- did not match RegEx: "#include.?>"
   125 "    }"
       -- did not match RegEx: "#include.?>"
   126 "    else"
       -- did not match RegEx: "#include.?>"
   127 "    {"
       -- did not match RegEx: "#include.?>"
   128 "      src_ = nullptr;"
       -- did not match RegEx: "#include.?>"
   129 "      return false;"
       -- did not match RegEx: "#include.?>"
   130 "    }"
       -- did not match RegEx: "#include.?>"
   131 "  }"
       -- did not match RegEx: "#include.?>"
   132 "  //----< stores std::istringstream pointer derived from text >------"
       -- did not match RegEx: "#include.?>"
   133 ""
       -- did not match RegEx: "#include.?>"
   134 "  inline bool RegExHelper::makeStringStreamSrc(const std::string& text)"
       -- did not match RegEx: "#include.?>"
   135 "  {"
       -- did not match RegEx: "#include.?>"
   136 "    std::istringstream* sPtr = new std::istringstream(text);"
       -- did not match RegEx: "#include.?>"
   137 "    if (sPtr->good())"
       -- did not match RegEx: "#include.?>"
   138 "    {"
       -- did not match RegEx: "#include.?>"
   139 "      src_ = srcStreamPtr(sPtr);"
       -- did not match RegEx: "#include.?>"
   140 "      return true;"
       -- did not match RegEx: "#include.?>"
   141 "    }"
       -- did not match RegEx: "#include.?>"
   142 "    else"
       -- did not match RegEx: "#include.?>"
   143 "    {"
       -- did not match RegEx: "#include.?>"
   144 "      src_ = nullptr;"
       -- did not match RegEx: "#include.?>"
   145 "      return false;"
       -- did not match RegEx: "#include.?>"
   146 "    }"
       -- did not match RegEx: "#include.?>"
   147 "  }"
       -- did not match RegEx: "#include.?>"
   148 "  //----< safely extract line from source stream >-------------------"
       -- did not match RegEx: "#include.?>"
   149 ""
       -- did not match RegEx: "#include.?>"
   150 "  Line RegExHelper::getLine()"
       -- did not match RegEx: "#include.?>"
   151 "  {"
       -- did not match RegEx: "#include.?>"
   152 "    Line temp;"
       -- did not match RegEx: "#include.?>"
   153 "    int ch;"
       -- did not match RegEx: "#include.?>"
   154 "    while (true)"
       -- did not match RegEx: "#include.?>"
   155 "    {"
       -- did not match RegEx: "#include.?>"
   156 "      if (!src_->good())"
       -- did not match RegEx: "#include.?>"
   157 "        break;"
       -- did not match RegEx: "#include.?>"
   158 "      ch = src_->get();"
       -- did not match RegEx: "#include.?>"
   159 "      if (ch != '\n')"
       -- did not match RegEx: "#include.?>"
   160 "        temp.push_back(ch);"
       -- did not match RegEx: "#include.?>"
   161 "      else"
       -- did not match RegEx: "#include.?>"
   162 "        break;"
       -- did not match RegEx: "#include.?>"
   163 "    }"
       -- did not match RegEx: "#include.?>"
   164 "    return temp;"
       -- did not match RegEx: "#include.?>"
   165 "  }"
       -- did not match RegEx: "#include.?>"
   166 "  //----< stores lines that match stored regular expression >--------"
       -- did not match RegEx: "#include.?>"
   167 ""
       -- did not match RegEx: "#include.?>"
   168 "  inline bool RegExHelper::search()"
       -- did not match RegEx: "#include.?>"
   169 "  {"
       -- did not match RegEx: "#include.?>"
   170 "    // MatchLine = std::tuple<Line, MatchString, LineCount, Matches>;"
       -- did not match RegEx: "#include.?>"
   171 ""
       -- did not match RegEx: "#include.?>"
   172 "    size_t count = 0;"
       -- did not match RegEx: "#include.?>"
   173 "    do"
       -- did not match RegEx: "#include.?>"
   174 "    {"
       -- did not match RegEx: "#include.?>"
   175 "      ++count;"
       -- did not match RegEx: "#include.?>"
   176 "      Line line = getLine();"
       -- did not match RegEx: "#include.?>"
   177 "      std::smatch match;"
       -- did not match RegEx: "#include.?>"
   178 "      bool matches = std::regex_search(line, match, regex_);"
       -- did not match RegEx: "#include.?>"
   179 "      MatchString ms;"
       -- did not match RegEx: "#include.?>"
   180 "      if (matches)"
       -- did not match RegEx: "#include.?>"
   181 "      {"
       -- did not match RegEx: "#include.?>"
   182 "        ms = match[0];  // only returning first match in each line"
       -- did not match RegEx: "#include.?>"
   183 "      }"
       -- did not match RegEx: "#include.?>"
   184 "      else"
       -- did not match RegEx: "#include.?>"
   185 "      {"
       -- did not match RegEx: "#include.?>"
   186 "        ms = "";"
       -- did not match RegEx: "#include.?>"
   187 "      }"
       -- did not match RegEx: "#include.?>"
   188 "      MatchLine mline = std::make_tuple(line, ms, count, matches);"
       -- did not match RegEx: "#include.?>"
   189 "      srcLines_.push_back(mline);"
       -- did not match RegEx: "#include.?>"
   190 "    } while (src_->good());"
       -- did not match RegEx: "#include.?>"
   191 "    return bool(matches);  // cast eliminates an unnecessary warning"
       -- did not match RegEx: "#include.?>"
   192 "  }"
       -- did not match RegEx: "#include.?>"
   193 "  //----< indexes stored MatchLines >--------------------------------"
       -- did not match RegEx: "#include.?>"
   194 ""
       -- did not match RegEx: "#include.?>"
   195 "  inline MatchLine& RegExHelper::operator[](size_t n)"
       -- did not match RegEx: "#include.?>"
   196 "  {"
       -- did not match RegEx: "#include.?>"
   197 "    return srcLines_[n];"
       -- did not match RegEx: "#include.?>"
   198 "  }"
       -- did not match RegEx: "#include.?>"
   199 "  //----< indexes const stored MatchLines >--------------------------"
       -- did not match RegEx: "#include.?>"
   200 ""
       -- did not match RegEx: "#include.?>"
   201 "  inline MatchLine RegExHelper::operator[](size_t n) const"
       -- did not match RegEx: "#include.?>"
   202 "  {"
       -- did not match RegEx: "#include.?>"
   203 "    return srcLines_[n];"
       -- did not match RegEx: "#include.?>"
   204 "  }"
       -- did not match RegEx: "#include.?>"
   205 "  //----< return iterator pointing to beginning of MatchLines >------"
       -- did not match RegEx: "#include.?>"
   206 ""
       -- did not match RegEx: "#include.?>"
   207 "  inline iterator RegExHelper::begin()"
       -- did not match RegEx: "#include.?>"
   208 "  {"
       -- did not match RegEx: "#include.?>"
   209 "    return srcLines_.begin();"
       -- did not match RegEx: "#include.?>"
   210 "  }"
       -- did not match RegEx: "#include.?>"
   211 "  //----< return iterator pointing to end of MatchLines >------------"
       -- did not match RegEx: "#include.?>"
   212 ""
       -- did not match RegEx: "#include.?>"
   213 "  inline iterator RegExHelper::end()"
       -- did not match RegEx: "#include.?>"
   214 "  {"
       -- did not match RegEx: "#include.?>"
   215 "    return srcLines_.end();"
       -- did not match RegEx: "#include.?>"
   216 "  }"
       -- did not match RegEx: "#include.?>"
   217 "  //----< return size of stored MatchLines collection >--------------"
       -- did not match RegEx: "#include.?>"
   218 ""
       -- did not match RegEx: "#include.?>"
   219 "  inline size_t RegExHelper::size()"
       -- did not match RegEx: "#include.?>"
   220 "  {"
       -- did not match RegEx: "#include.?>"
   221 "    return srcLines_.size();"
       -- did not match RegEx: "#include.?>"
   222 "  }"
       -- did not match RegEx: "#include.?>"
   223 "}"
       -- did not match RegEx: "#include.?>"

press enter to quit: 