mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-05 06:16:51 +08:00
Clean up some sloppy include directives
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
|
||||
#include <alpr.h>
|
||||
#include "openalprgo.h"
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
|
||||
#include <alpr.h>
|
||||
|
@@ -1,4 +1,7 @@
|
||||
#include "beanstalk.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
@@ -1,7 +1,8 @@
|
||||
#include "beanstalk.hpp"
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@@ -1,8 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
@@ -1,7 +1,8 @@
|
||||
#ifndef OPENALPR_BENCHMARKUTILS_H
|
||||
#define OPENALPR_BENCHMARKUTILS_H
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
std::vector<std::string> filterByExtension(std::vector<std::string> fileList, std::string extension);
|
||||
|
||||
|
@@ -1,5 +1,8 @@
|
||||
#include "endtoendtest.h"
|
||||
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace alpr;
|
||||
|
@@ -1,6 +1,9 @@
|
||||
#ifndef OPENALPR_ENDTOENDTEST_H
|
||||
#define OPENALPR_ENDTOENDTEST_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include "opencv2/imgproc/imgproc.hpp"
|
||||
|
@@ -22,8 +22,8 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "../tclap/CmdLine.h"
|
||||
#include "utility.h"
|
||||
#include "support/utf8.h"
|
||||
|
@@ -20,6 +20,8 @@
|
||||
#include "alpr.h"
|
||||
#include "alpr_impl.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
namespace alpr
|
||||
{
|
||||
|
||||
|
@@ -20,10 +20,9 @@
|
||||
#ifndef OPENALPR_ALPR_H
|
||||
#define OPENALPR_ALPR_H
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
|
||||
#ifdef WIN32
|
||||
#define OPENALPR_DLL_EXPORT __declspec( dllexport )
|
||||
|
@@ -22,8 +22,6 @@
|
||||
|
||||
#include "support/filesystem.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include "opencv2/opencv.hpp"
|
||||
|
||||
namespace alpr
|
||||
|
@@ -24,11 +24,8 @@
|
||||
|
||||
#include "constants.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <stdlib.h> /* getenv */
|
||||
#include <math.h>
|
||||
|
||||
namespace alpr
|
||||
{
|
||||
|
@@ -20,8 +20,8 @@
|
||||
#ifndef OPENALPR_REGIONDETECTOR_H
|
||||
#define OPENALPR_REGIONDETECTOR_H
|
||||
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
#include "utility.h"
|
||||
|
@@ -19,6 +19,8 @@
|
||||
|
||||
#include "detectorcpu.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
|
@@ -20,8 +20,6 @@
|
||||
#ifndef OPENALPR_DETECTORCPU_H
|
||||
#define OPENALPR_DETECTORCPU_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include "opencv2/objdetect/objdetect.hpp"
|
||||
|
@@ -21,8 +21,6 @@
|
||||
#define OPENALPR_DETECTORCUDA_H
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#ifdef COMPILE_GPU
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#ifndef OPENALPR_DETECTORMASK_H
|
||||
#define OPENALPR_DETECTORMASK_H
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include "opencv2/imgproc/imgproc.hpp"
|
||||
#include "config.h"
|
||||
#include "prewarp.h"
|
||||
|
@@ -20,8 +20,6 @@
|
||||
#ifndef OPENALPR_DETECTORMORPH_H
|
||||
#define OPENALPR_DETECTORMORPH_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include "opencv2/objdetect/objdetect.hpp"
|
||||
|
@@ -20,8 +20,6 @@
|
||||
#ifndef OPENALPR_DETECTOROPENCL_H
|
||||
#define OPENALPR_DETECTOROPENCL_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#if OPENCV_MAJOR_VERSION == 3
|
||||
|
@@ -17,7 +17,8 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
|
||||
#include "scorekeeper.h"
|
||||
|
||||
|
@@ -21,8 +21,7 @@
|
||||
#define OPENALPR_SCOREKEEPER_H
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <vector>
|
||||
|
||||
namespace alpr
|
||||
{
|
||||
|
@@ -20,8 +20,6 @@
|
||||
#ifndef OPENALPR_LICENSEPLATECANDIDATE_H
|
||||
#define OPENALPR_LICENSEPLATECANDIDATE_H
|
||||
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <vector>
|
||||
|
||||
#include "opencv2/imgproc/imgproc.hpp"
|
||||
|
@@ -20,9 +20,6 @@
|
||||
#ifndef OPENALPR_SEGMENT_H
|
||||
#define OPENALPR_SEGMENT_H
|
||||
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "opencv2/imgproc/imgproc.hpp"
|
||||
|
||||
namespace alpr
|
||||
|
@@ -21,7 +21,6 @@
|
||||
#define OPENALPR_SEGMENTATIONGROUP_H
|
||||
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "opencv2/imgproc/imgproc.hpp"
|
||||
|
||||
|
@@ -20,8 +20,7 @@
|
||||
#ifndef OPENALPR_TESSERACTOCR_H
|
||||
#define OPENALPR_TESSERACTOCR_H
|
||||
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <vector>
|
||||
|
||||
#include "utility.h"
|
||||
#include "config.h"
|
||||
|
@@ -19,6 +19,10 @@
|
||||
|
||||
#include "postprocess.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <queue>
|
||||
#include <utility>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace alpr
|
||||
|
@@ -23,12 +23,9 @@
|
||||
#include "regexrule.h"
|
||||
#include "constants.h"
|
||||
#include "utility.h"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <queue>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "config.h"
|
||||
|
||||
|
||||
|
@@ -17,6 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include "regexrule.h"
|
||||
|
@@ -20,10 +20,8 @@
|
||||
#ifndef OPENALPR_REGEXRULE_H
|
||||
#define OPENALPR_REGEXRULE_H
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
|
||||
#include "support/re2.h"
|
||||
#include "support/utf8.h"
|
||||
#include "support/tinythread.h"
|
||||
|
@@ -19,6 +19,8 @@
|
||||
|
||||
#include "result_aggregator.h"
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
|
@@ -1,6 +1,11 @@
|
||||
#include "filesystem.h"
|
||||
#include <sstream>
|
||||
|
||||
#include <algorithm>
|
||||
#include <errno.h>
|
||||
#include <fstream>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
|
||||
namespace alpr
|
||||
{
|
||||
|
@@ -13,14 +13,10 @@ typedef int mode_t;
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <sys/stat.h>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
#include <errno.h>
|
||||
|
||||
namespace alpr
|
||||
{
|
||||
|
@@ -27,6 +27,29 @@
|
||||
#include "util/flags.h"
|
||||
#include "util/sparse_set.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <stdio.h>
|
||||
#include <vector>
|
||||
|
||||
#if defined(__GNUC__) && !defined(USE_CXX0X) && !defined(_LIBCPP_ABI_VERSION)
|
||||
|
||||
#include <tr1/unordered_set>
|
||||
using std::tr1::unordered_set;
|
||||
|
||||
#else
|
||||
|
||||
#include <unordered_set>
|
||||
#if defined(_WIN32)
|
||||
using std::tr1::unordered_set;
|
||||
#else
|
||||
using std::unordered_set;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
using std::swap;
|
||||
using std::vector;
|
||||
|
||||
DEFINE_bool(re2_dfa_bail_when_slow, true,
|
||||
"Whether the RE2 DFA should bail out early "
|
||||
"if the NFA would be faster (for testing).");
|
||||
@@ -168,6 +191,7 @@ class DFA {
|
||||
#endif // STL_MSVC
|
||||
};
|
||||
|
||||
|
||||
#ifdef STL_MSVC
|
||||
typedef unordered_set<State*, StateHash> StateSet;
|
||||
#else // !STL_MSVC
|
||||
@@ -711,7 +735,7 @@ DFA::State* DFA::WorkqToCachedState(Workq* q, uint flag) {
|
||||
int* markp = ip;
|
||||
while (markp < ep && *markp != Mark)
|
||||
markp++;
|
||||
sort(ip, markp);
|
||||
std::sort(ip, markp);
|
||||
if (markp < ep)
|
||||
markp++;
|
||||
ip = markp;
|
||||
|
@@ -29,6 +29,8 @@
|
||||
#include "util/sparse_array.h"
|
||||
#include "util/sparse_set.h"
|
||||
|
||||
using std::swap;
|
||||
|
||||
namespace re2 {
|
||||
|
||||
class NFA {
|
||||
|
@@ -476,8 +476,8 @@ bool Prog::IsOnePass() {
|
||||
}
|
||||
}
|
||||
if (ip->foldcase()) {
|
||||
Rune lo = max<Rune>(ip->lo(), 'a') + 'A' - 'a';
|
||||
Rune hi = min<Rune>(ip->hi(), 'z') + 'A' - 'a';
|
||||
Rune lo = std::max<Rune>(ip->lo(), 'a') + 'A' - 'a';
|
||||
Rune hi = std::min<Rune>(ip->hi(), 'z') + 'A' - 'a';
|
||||
for (int c = lo; c <= hi; c++) {
|
||||
int b = bytemap_[c];
|
||||
c = unbytemap_[b]; // last c in class
|
||||
|
@@ -24,6 +24,8 @@
|
||||
#include "re2/walker-inl.h"
|
||||
|
||||
namespace re2 {
|
||||
|
||||
using std::string;
|
||||
|
||||
// Regular expression parse state.
|
||||
// The list of parsed regexps so far is maintained as a vector of
|
||||
@@ -340,7 +342,7 @@ static void AddFoldedRange(CharClassBuilder* cc, Rune lo, Rune hi, int depth) {
|
||||
// Add in the result of folding the range lo - f->hi
|
||||
// and that range's fold, recursively.
|
||||
Rune lo1 = lo;
|
||||
Rune hi1 = min<Rune>(hi, f->hi);
|
||||
Rune hi1 = std::min<Rune>(hi, f->hi);
|
||||
switch (f->delta) {
|
||||
default:
|
||||
lo1 += f->delta;
|
||||
|
@@ -8,6 +8,9 @@
|
||||
#include "re2/unicode_casefold.h"
|
||||
#include "re2/walker-inl.h"
|
||||
|
||||
using std::set;
|
||||
using std::vector;
|
||||
|
||||
namespace re2 {
|
||||
|
||||
static const int Trace = false;
|
||||
|
@@ -9,6 +9,9 @@
|
||||
#ifndef RE2_PREFILTER_H_
|
||||
#define RE2_PREFILTER_H_
|
||||
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include "util/util.h"
|
||||
|
||||
namespace re2 {
|
||||
@@ -32,19 +35,19 @@ class Prefilter {
|
||||
~Prefilter();
|
||||
|
||||
Op op() { return op_; }
|
||||
const string& atom() const { return atom_; }
|
||||
const std::string& atom() const { return atom_; }
|
||||
void set_unique_id(int id) { unique_id_ = id; }
|
||||
int unique_id() const { return unique_id_; }
|
||||
|
||||
// The children of the Prefilter node.
|
||||
vector<Prefilter*>* subs() {
|
||||
std::vector<Prefilter*>* subs() {
|
||||
CHECK(op_ == AND || op_ == OR);
|
||||
return subs_;
|
||||
}
|
||||
|
||||
// Set the children vector. Prefilter takes ownership of subs and
|
||||
// subs_ will be deleted when Prefilter is deleted.
|
||||
void set_subs(vector<Prefilter*>* subs) { subs_ = subs; }
|
||||
void set_subs(std::vector<Prefilter*>* subs) { subs_ = subs; }
|
||||
|
||||
// Given a RE2, return a Prefilter. The caller takes ownership of
|
||||
// the Prefilter and should deallocate it. Returns NULL if Prefilter
|
||||
@@ -52,7 +55,7 @@ class Prefilter {
|
||||
static Prefilter* FromRE2(const RE2* re2);
|
||||
|
||||
// Returns a readable debug string of the prefilter.
|
||||
string DebugString() const;
|
||||
std::string DebugString() const;
|
||||
|
||||
private:
|
||||
class Info;
|
||||
@@ -70,9 +73,9 @@ class Prefilter {
|
||||
|
||||
static Prefilter* FromRegexp(Regexp* a);
|
||||
|
||||
static Prefilter* FromString(const string& str);
|
||||
static Prefilter* FromString(const std::string& str);
|
||||
|
||||
static Prefilter* OrStrings(set<string>* ss);
|
||||
static Prefilter* OrStrings(std::set<std::string>* ss);
|
||||
|
||||
static Info* BuildInfo(Regexp* re);
|
||||
|
||||
@@ -82,10 +85,10 @@ class Prefilter {
|
||||
Op op_;
|
||||
|
||||
// Sub-matches for AND or OR Prefilter.
|
||||
vector<Prefilter*>* subs_;
|
||||
std::vector<Prefilter*>* subs_;
|
||||
|
||||
// Actual string to match in leaf node.
|
||||
string atom_;
|
||||
std::string atom_;
|
||||
|
||||
// If different prefilters have the same string atom, or if they are
|
||||
// structurally the same (e.g., OR of same atom strings) they are
|
||||
|
@@ -8,6 +8,10 @@
|
||||
#include "re2/prefilter_tree.h"
|
||||
#include "re2.h"
|
||||
|
||||
using std::set;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
DEFINE_int32(filtered_re2_min_atom_len,
|
||||
3,
|
||||
"Strings less than this length are not stored as atoms");
|
||||
|
@@ -16,13 +16,16 @@
|
||||
#ifndef RE2_PREFILTER_TREE_H_
|
||||
#define RE2_PREFILTER_TREE_H_
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include "util/util.h"
|
||||
#include "util/sparse_array.h"
|
||||
|
||||
namespace re2 {
|
||||
|
||||
typedef SparseArray<int> IntMap;
|
||||
typedef map<int, int> StdIntMap;
|
||||
typedef std::map<int, int> StdIntMap;
|
||||
|
||||
class Prefilter;
|
||||
|
||||
@@ -42,15 +45,15 @@ class PrefilterTree {
|
||||
// The caller should use the returned set of strings to do string matching.
|
||||
// Each time a string matches, the corresponding index then has to be
|
||||
// and passed to RegexpsGivenStrings below.
|
||||
void Compile(vector<string>* atom_vec);
|
||||
void Compile(std::vector<std::string>* atom_vec);
|
||||
|
||||
// Given the indices of the atoms that matched, returns the indexes
|
||||
// of regexps that should be searched. The matched_atoms should
|
||||
// contain all the ids of string atoms that were found to match the
|
||||
// content. The caller can use any string match engine to perform
|
||||
// this function. This function is thread safe.
|
||||
void RegexpsGivenStrings(const vector<int>& matched_atoms,
|
||||
vector<int>* regexps) const;
|
||||
void RegexpsGivenStrings(const std::vector<int>& matched_atoms,
|
||||
std::vector<int>* regexps) const;
|
||||
|
||||
// Print debug prefilter. Also prints unique ids associated with
|
||||
// nodes of the prefilter of the regexp.
|
||||
@@ -76,17 +79,17 @@ class PrefilterTree {
|
||||
|
||||
// When this node is ready to trigger the parent, what are the
|
||||
// regexps that are triggered.
|
||||
vector<int> regexps;
|
||||
std::vector<int> regexps;
|
||||
};
|
||||
|
||||
private:
|
||||
// This function assigns unique ids to various parts of the
|
||||
// prefilter, by looking at if these nodes are already in the
|
||||
// PrefilterTree.
|
||||
void AssignUniqueIds(vector<string>* atom_vec);
|
||||
void AssignUniqueIds(std::vector<std::string>* atom_vec);
|
||||
|
||||
// Given the matching atoms, find the regexps to be triggered.
|
||||
void PropagateMatch(const vector<int>& atom_ids,
|
||||
void PropagateMatch(const std::vector<int>& atom_ids,
|
||||
IntMap* regexps) const;
|
||||
|
||||
// Returns the prefilter node that has the same NodeString as this
|
||||
@@ -95,30 +98,30 @@ class PrefilterTree {
|
||||
|
||||
// A string that uniquely identifies the node. Assumes that the
|
||||
// children of node has already been assigned unique ids.
|
||||
string NodeString(Prefilter* node) const;
|
||||
std::string NodeString(Prefilter* node) const;
|
||||
|
||||
// Recursively constructs a readable prefilter string.
|
||||
string DebugNodeString(Prefilter* node) const;
|
||||
std::string DebugNodeString(Prefilter* node) const;
|
||||
|
||||
// Used for debugging.
|
||||
void PrintDebugInfo();
|
||||
|
||||
// These are all the nodes formed by Compile. Essentially, there is
|
||||
// one node for each unique atom and each unique AND/OR node.
|
||||
vector<Entry> entries_;
|
||||
std::vector<Entry> entries_;
|
||||
|
||||
// Map node string to canonical Prefilter node.
|
||||
map<string, Prefilter*> node_map_;
|
||||
std::map<std::string, Prefilter*> node_map_;
|
||||
|
||||
// indices of regexps that always pass through the filter (since we
|
||||
// found no required literals in these regexps).
|
||||
vector<int> unfiltered_;
|
||||
std::vector<int> unfiltered_;
|
||||
|
||||
// vector of Prefilter for all regexps.
|
||||
vector<Prefilter*> prefilter_vec_;
|
||||
std::vector<Prefilter*> prefilter_vec_;
|
||||
|
||||
// Atom index in returned strings to entry id mapping.
|
||||
vector<int> atom_index_to_id_;
|
||||
std::vector<int> atom_index_to_id_;
|
||||
|
||||
// Has the prefilter tree been compiled.
|
||||
bool compiled_;
|
||||
|
@@ -13,6 +13,8 @@
|
||||
#include "re2/util/sparse_array.h"
|
||||
#include "re2.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace re2 {
|
||||
|
||||
// Simple fixed-size bitmap.
|
||||
@@ -273,7 +275,7 @@ class Prog {
|
||||
bool SearchDFA(const StringPiece& text, const StringPiece& context,
|
||||
Anchor anchor, MatchKind kind,
|
||||
StringPiece* match0, bool* failed,
|
||||
vector<int>* matches);
|
||||
std::vector<int>* matches);
|
||||
|
||||
// Build the entire DFA for the given match kind. FOR TESTING ONLY.
|
||||
// Usually the DFA is built out incrementally, as needed, which
|
||||
|
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "re2.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#ifndef WIN32
|
||||
#include <pthread.h>
|
||||
|
@@ -5,11 +5,17 @@
|
||||
// Regular expression representation.
|
||||
// Tested by parse_test.cc
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "util/util.h"
|
||||
#include "re2/regexp.h"
|
||||
#include "re2/stringpiece.h"
|
||||
#include "re2/walker-inl.h"
|
||||
|
||||
using std::map;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
namespace re2 {
|
||||
|
||||
// Constructor. Allocates vectors as appropriate for operator.
|
||||
@@ -712,13 +718,13 @@ bool CharClassBuilder::AddRange(Rune lo, Rune hi) {
|
||||
if (lo <= 'z' && hi >= 'A') {
|
||||
// Overlaps some alpha, maybe not all.
|
||||
// Update bitmaps telling which ASCII letters are in the set.
|
||||
Rune lo1 = max<Rune>(lo, 'A');
|
||||
Rune hi1 = min<Rune>(hi, 'Z');
|
||||
Rune lo1 = std::max<Rune>(lo, 'A');
|
||||
Rune hi1 = std::min<Rune>(hi, 'Z');
|
||||
if (lo1 <= hi1)
|
||||
upper_ |= ((1 << (hi1 - lo1 + 1)) - 1) << (lo1 - 'A');
|
||||
|
||||
lo1 = max<Rune>(lo, 'a');
|
||||
hi1 = min<Rune>(hi, 'z');
|
||||
lo1 = std::max<Rune>(lo, 'a');
|
||||
hi1 = std::min<Rune>(hi, 'z');
|
||||
if (lo1 <= hi1)
|
||||
lower_ |= ((1 << (hi1 - lo1 + 1)) - 1) << (lo1 - 'a');
|
||||
}
|
||||
|
@@ -86,6 +86,9 @@
|
||||
#ifndef RE2_REGEXP_H__
|
||||
#define RE2_REGEXP_H__
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
#include "util/util.h"
|
||||
#include "re2/stringpiece.h"
|
||||
|
||||
@@ -187,7 +190,7 @@ class RegexpStatus {
|
||||
|
||||
void set_code(enum RegexpStatusCode code) { code_ = code; }
|
||||
void set_error_arg(const StringPiece& error_arg) { error_arg_ = error_arg; }
|
||||
void set_tmp(string* tmp) { delete tmp_; tmp_ = tmp; }
|
||||
void set_tmp(std::string* tmp) { delete tmp_; tmp_ = tmp; }
|
||||
enum RegexpStatusCode code() const { return code_; }
|
||||
const StringPiece& error_arg() const { return error_arg_; }
|
||||
bool ok() const { return code() == kRegexpSuccess; }
|
||||
@@ -197,16 +200,16 @@ class RegexpStatus {
|
||||
|
||||
// Returns text equivalent of code, e.g.:
|
||||
// "Bad character class"
|
||||
static string CodeText(enum RegexpStatusCode code);
|
||||
static std::string CodeText(enum RegexpStatusCode code);
|
||||
|
||||
// Returns text describing error, e.g.:
|
||||
// "Bad character class: [z-a]"
|
||||
string Text() const;
|
||||
std::string Text() const;
|
||||
|
||||
private:
|
||||
enum RegexpStatusCode code_; // Kind of error
|
||||
StringPiece error_arg_; // Piece of regexp containing syntax error.
|
||||
string* tmp_; // Temporary storage, possibly where error_arg_ is.
|
||||
std::string* tmp_; // Temporary storage, possibly where error_arg_ is.
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(RegexpStatus);
|
||||
};
|
||||
@@ -328,7 +331,7 @@ class Regexp {
|
||||
Rune rune() { DCHECK_EQ(op_, kRegexpLiteral); return rune_; }
|
||||
CharClass* cc() { DCHECK_EQ(op_, kRegexpCharClass); return cc_; }
|
||||
int cap() { DCHECK_EQ(op_, kRegexpCapture); return cap_; }
|
||||
const string* name() { DCHECK_EQ(op_, kRegexpCapture); return name_; }
|
||||
const std::string* name() { DCHECK_EQ(op_, kRegexpCapture); return name_; }
|
||||
Rune* runes() { DCHECK_EQ(op_, kRegexpLiteralString); return runes_; }
|
||||
int nrunes() { DCHECK_EQ(op_, kRegexpLiteralString); return nrunes_; }
|
||||
int match_id() { DCHECK_EQ(op_, kRegexpHaveMatch); return match_id_; }
|
||||
@@ -359,7 +362,7 @@ class Regexp {
|
||||
// string representation of the simplified form. Returns true on success.
|
||||
// Returns false and sets *status (if status != NULL) on parse error.
|
||||
static bool SimplifyRegexp(const StringPiece& src, ParseFlags flags,
|
||||
string* dst,
|
||||
std::string* dst,
|
||||
RegexpStatus* status);
|
||||
|
||||
// Returns the number of capturing groups in the regexp.
|
||||
@@ -369,16 +372,16 @@ class Regexp {
|
||||
// Returns a map from names to capturing group indices,
|
||||
// or NULL if the regexp contains no named capture groups.
|
||||
// The caller is responsible for deleting the map.
|
||||
map<string, int>* NamedCaptures();
|
||||
std::map<std::string, int>* NamedCaptures();
|
||||
|
||||
// Returns a map from capturing group indices to capturing group
|
||||
// names or NULL if the regexp contains no named capture groups. The
|
||||
// caller is responsible for deleting the map.
|
||||
map<int, string>* CaptureNames();
|
||||
std::map<int, std::string>* CaptureNames();
|
||||
|
||||
// Returns a string representation of the current regexp,
|
||||
// using as few parentheses as possible.
|
||||
string ToString();
|
||||
std::string ToString();
|
||||
|
||||
// Convenience functions. They consume the passed reference,
|
||||
// so in many cases you should use, e.g., Plus(re->Incref(), flags).
|
||||
@@ -400,7 +403,7 @@ class Regexp {
|
||||
|
||||
// Debugging function. Returns string format for regexp
|
||||
// that makes structure clear. Does NOT use regexp syntax.
|
||||
string Dump();
|
||||
std::string Dump();
|
||||
|
||||
// Helper traversal class, defined fully in walker-inl.h.
|
||||
template<typename T> class Walker;
|
||||
@@ -427,7 +430,7 @@ class Regexp {
|
||||
// begin with a non-empty fixed string (perhaps after ASCII
|
||||
// case-folding). If so, returns the prefix and the sub-regexp that
|
||||
// follows it.
|
||||
bool RequiredPrefix(string* prefix, bool *foldcase, Regexp** suffix);
|
||||
bool RequiredPrefix(std::string* prefix, bool *foldcase, Regexp** suffix);
|
||||
|
||||
private:
|
||||
// Constructor allocates vectors as appropriate for operator.
|
||||
@@ -550,7 +553,7 @@ class Regexp {
|
||||
};
|
||||
struct { // Capture
|
||||
int cap_;
|
||||
string* name_;
|
||||
std::string* name_;
|
||||
};
|
||||
struct { // LiteralString
|
||||
int nrunes_;
|
||||
@@ -572,7 +575,7 @@ class Regexp {
|
||||
};
|
||||
|
||||
// Character class set: contains non-overlapping, non-abutting RuneRanges.
|
||||
typedef set<RuneRange, RuneRangeLess> RuneRangeSet;
|
||||
typedef std::set<RuneRange, RuneRangeLess> RuneRangeSet;
|
||||
|
||||
class CharClassBuilder {
|
||||
public:
|
||||
|
@@ -11,6 +11,8 @@
|
||||
#include "re2/walker-inl.h"
|
||||
|
||||
namespace re2 {
|
||||
|
||||
using std::string;
|
||||
|
||||
// Parses the regexp src and then simplifies it and sets *dst to the
|
||||
// string representation of the simplified form. Returns true on success.
|
||||
|
@@ -2,9 +2,12 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "re2/stringpiece.h"
|
||||
#include "util/util.h"
|
||||
|
||||
using std::string;
|
||||
using re2::StringPiece;
|
||||
|
||||
std::ostream& operator<<(std::ostream& o, const StringPiece& piece) {
|
||||
@@ -34,7 +37,7 @@ void StringPiece::CopyToString(string* target) const {
|
||||
}
|
||||
|
||||
int StringPiece::copy(char* buf, size_type n, size_type pos) const {
|
||||
int ret = min(length_ - pos, n);
|
||||
int ret = std::min(length_ - pos, n);
|
||||
memcpy(buf, ptr_ + pos, ret);
|
||||
return ret;
|
||||
}
|
||||
@@ -64,16 +67,16 @@ int StringPiece::find(char c, size_type pos) const {
|
||||
int StringPiece::rfind(const StringPiece& s, size_type pos) const {
|
||||
if (length_ < s.length_) return npos;
|
||||
const size_t ulen = length_;
|
||||
if (s.length_ == 0) return min(ulen, pos);
|
||||
if (s.length_ == 0) return std::min(ulen, pos);
|
||||
|
||||
const char* last = ptr_ + min(ulen - s.length_, pos) + s.length_;
|
||||
const char* last = ptr_ + std::min(ulen - s.length_, pos) + s.length_;
|
||||
const char* result = std::find_end(ptr_, last, s.ptr_, s.ptr_ + s.length_);
|
||||
return result != last ? result - ptr_ : npos;
|
||||
}
|
||||
|
||||
int StringPiece::rfind(char c, size_type pos) const {
|
||||
if (length_ <= 0) return npos;
|
||||
for (int i = min(pos, static_cast<size_type>(length_ - 1));
|
||||
for (int i = std::min(pos, static_cast<size_type>(length_ - 1));
|
||||
i >= 0; --i) {
|
||||
if (ptr_[i] == c) {
|
||||
return i;
|
||||
|
@@ -9,6 +9,8 @@
|
||||
#include "re2/regexp.h"
|
||||
#include "re2/walker-inl.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace re2 {
|
||||
|
||||
enum {
|
||||
|
@@ -7,7 +7,11 @@
|
||||
#ifndef RE2_UTIL_LOGGING_H__
|
||||
#define RE2_UTIL_LOGGING_H__
|
||||
|
||||
#include <assert.h>
|
||||
#include <ostream>
|
||||
#include <stdio.h> /* for fwrite */
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
// Debug-only checking.
|
||||
@@ -53,7 +57,7 @@ class LogMessage {
|
||||
}
|
||||
void Flush() {
|
||||
stream() << "\n";
|
||||
string s = str_.str();
|
||||
std::string s = str_.str();
|
||||
size_t n = s.size();
|
||||
if (fwrite(s.data(), 1, n, stderr) < n) {} // shut up gcc
|
||||
flushed_ = true;
|
||||
@@ -63,7 +67,7 @@ class LogMessage {
|
||||
Flush();
|
||||
}
|
||||
}
|
||||
ostream& stream() { return str_; }
|
||||
std::ostream& stream() { return str_; }
|
||||
|
||||
private:
|
||||
bool flushed_;
|
||||
|
@@ -94,6 +94,10 @@
|
||||
|
||||
#include "re2/util/util.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
namespace re2 {
|
||||
|
||||
template<typename Value>
|
||||
@@ -107,8 +111,8 @@ class SparseArray {
|
||||
class IndexValue;
|
||||
|
||||
typedef IndexValue value_type;
|
||||
typedef typename vector<IndexValue>::iterator iterator;
|
||||
typedef typename vector<IndexValue>::const_iterator const_iterator;
|
||||
typedef typename std::vector<IndexValue>::iterator iterator;
|
||||
typedef typename std::vector<IndexValue>::const_iterator const_iterator;
|
||||
|
||||
inline const IndexValue& iv(int i) const;
|
||||
|
||||
@@ -160,7 +164,7 @@ class SparseArray {
|
||||
// Set the value at index i to v.
|
||||
inline iterator set(int i, Value v);
|
||||
|
||||
pair<iterator, bool> insert(const value_type& new_value);
|
||||
std::pair<iterator, bool> insert(const value_type& new_value);
|
||||
|
||||
// Returns the value at index i
|
||||
// or defaultv if index i is not initialized in the array.
|
||||
@@ -223,7 +227,7 @@ class SparseArray {
|
||||
int size_;
|
||||
int max_size_;
|
||||
int* sparse_to_dense_;
|
||||
vector<IndexValue> dense_;
|
||||
std::vector<IndexValue> dense_;
|
||||
bool valgrind_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(SparseArray);
|
||||
@@ -318,14 +322,14 @@ typename SparseArray<Value>::iterator SparseArray<Value>::set(int i, Value v) {
|
||||
}
|
||||
|
||||
template<typename Value>
|
||||
pair<typename SparseArray<Value>::iterator, bool> SparseArray<Value>::insert(
|
||||
std::pair<typename SparseArray<Value>::iterator, bool> SparseArray<Value>::insert(
|
||||
const value_type& new_value) {
|
||||
DebugCheckInvariants();
|
||||
pair<typename SparseArray<Value>::iterator, bool> p;
|
||||
std::pair<typename SparseArray<Value>::iterator, bool> p;
|
||||
if (has_index(new_value.index_)) {
|
||||
p = make_pair(dense_.begin() + sparse_to_dense_[new_value.index_], false);
|
||||
p = std::make_pair(dense_.begin() + sparse_to_dense_[new_value.index_], false);
|
||||
} else {
|
||||
p = make_pair(set_new(new_value.index_, new_value.second), true);
|
||||
p = std::make_pair(set_new(new_value.index_, new_value.second), true);
|
||||
}
|
||||
DebugCheckInvariants();
|
||||
return p;
|
||||
|
@@ -49,6 +49,8 @@
|
||||
|
||||
#include "re2/util/util.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
namespace re2 {
|
||||
|
||||
static bool InitMemory() {
|
||||
|
@@ -4,6 +4,10 @@
|
||||
|
||||
#include "re2/util/util.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace re2 {
|
||||
|
||||
static void StringAppendV(string* dst, const char* format, va_list ap) {
|
||||
|
@@ -6,6 +6,8 @@
|
||||
#include "re2/stringpiece.h"
|
||||
|
||||
namespace re2 {
|
||||
|
||||
using std::string;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// CEscapeString()
|
||||
|
@@ -17,7 +17,6 @@
|
||||
#ifndef RE2_UTIL_UTF_H__
|
||||
#define RE2_UTIL_UTF_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace re2 {
|
||||
|
||||
|
@@ -6,60 +6,15 @@
|
||||
#define RE2_UTIL_UTIL_H__
|
||||
|
||||
// C
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h> // For size_t
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h> // For clock_gettime, CLOCK_REALTIME
|
||||
#include <ctype.h> // For isdigit, isalpha
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#include <sys/time.h> // For gettimeofday
|
||||
#endif
|
||||
|
||||
// C++
|
||||
#include <ctime>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <iosfwd>
|
||||
#include <map>
|
||||
#include <stack>
|
||||
#include <ostream>
|
||||
#include <utility>
|
||||
#include <set>
|
||||
|
||||
// Use std names.
|
||||
using std::set;
|
||||
using std::pair;
|
||||
using std::vector;
|
||||
using std::string;
|
||||
using std::min;
|
||||
using std::max;
|
||||
using std::ostream;
|
||||
using std::map;
|
||||
using std::stack;
|
||||
using std::sort;
|
||||
using std::swap;
|
||||
using std::make_pair;
|
||||
|
||||
#if defined(__GNUC__) && !defined(USE_CXX0X) && !defined(_LIBCPP_ABI_VERSION)
|
||||
|
||||
#include <tr1/unordered_set>
|
||||
using std::tr1::unordered_set;
|
||||
|
||||
#else
|
||||
|
||||
#include <unordered_set>
|
||||
#if defined(_WIN32)
|
||||
using std::tr1::unordered_set;
|
||||
#else
|
||||
using std::unordered_set;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -120,13 +75,13 @@ template<bool> struct CompileAssert {};
|
||||
|
||||
class StringPiece;
|
||||
|
||||
string CEscape(const StringPiece& src);
|
||||
std::string CEscape(const StringPiece& src);
|
||||
int CEscapeString(const char* src, int src_len, char* dest, int dest_len);
|
||||
|
||||
extern string StringPrintf(const char* format, ...);
|
||||
extern void SStringPrintf(string* dst, const char* format, ...);
|
||||
extern void StringAppendF(string* dst, const char* format, ...);
|
||||
extern string PrefixSuccessor(const StringPiece& prefix);
|
||||
extern std::string StringPrintf(const char* format, ...);
|
||||
extern void SStringPrintf(std::string* dst, const char* format, ...);
|
||||
extern void StringAppendF(std::string* dst, const char* format, ...);
|
||||
extern std::string PrefixSuccessor(const StringPiece& prefix);
|
||||
|
||||
uint32 hashword(const uint32*, size_t, uint32);
|
||||
void hashword2(const uint32*, size_t, uint32*, uint32*);
|
||||
|
@@ -13,6 +13,8 @@
|
||||
#ifndef RE2_WALKER_INL_H__
|
||||
#define RE2_WALKER_INL_H__
|
||||
|
||||
#include <stack>
|
||||
|
||||
#include "re2/regexp.h"
|
||||
|
||||
namespace re2 {
|
||||
@@ -86,7 +88,7 @@ template<typename T> class Regexp::Walker {
|
||||
|
||||
private:
|
||||
// Walk state for the entire traversal.
|
||||
stack<WalkState<T> >* stack_;
|
||||
std::stack<WalkState<T> >* stack_;
|
||||
bool stopped_early_;
|
||||
int max_visits_;
|
||||
|
||||
@@ -130,7 +132,7 @@ template<typename T> struct WalkState {
|
||||
};
|
||||
|
||||
template<typename T> Regexp::Walker<T>::Walker() {
|
||||
stack_ = new stack<WalkState<T> >;
|
||||
stack_ = new std::stack<WalkState<T> >;
|
||||
stopped_early_ = false;
|
||||
}
|
||||
|
||||
|
@@ -1,9 +1,7 @@
|
||||
#include "version.h"
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
|
||||
int cmpVersion(const char *v1, const char *v2)
|
||||
{
|
||||
int i;
|
||||
|
@@ -1,9 +1,6 @@
|
||||
#ifndef OPENALPR_VERSION_H
|
||||
#define OPENALPR_VERSION_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* return 1 if v1 > v2
|
||||
* return 0 if v1 = v2
|
||||
|
@@ -20,9 +20,8 @@
|
||||
#ifndef OPENALPR_UTILITY_H
|
||||
#define OPENALPR_UTILITY_H
|
||||
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "constants.h"
|
||||
#include "support/timing.h"
|
||||
@@ -30,7 +29,6 @@
|
||||
#include "opencv2/imgproc/imgproc.hpp"
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "binarize_wolf.h"
|
||||
#include <vector>
|
||||
#include "config.h"
|
||||
|
||||
namespace alpr
|
||||
|
@@ -34,9 +34,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstdio>
|
||||
|
||||
#if defined(HAVE_SSTREAM)
|
||||
#include <sstream>
|
||||
|
@@ -43,8 +43,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <algorithm>
|
||||
#include <stdlib.h> // Needed for exit(), which isn't defined in some envs.
|
||||
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
|
@@ -26,8 +26,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <algorithm>
|
||||
|
||||
namespace TCLAP
|
||||
|
@@ -25,8 +25,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <algorithm>
|
||||
|
||||
namespace TCLAP
|
||||
|
@@ -27,7 +27,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
namespace TCLAP
|
||||
{
|
||||
|
@@ -2,8 +2,10 @@
|
||||
#define OPENALPR_VIDEOBUFFER_H
|
||||
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
|
||||
|
Reference in New Issue
Block a user