Skip to content

Commit

Permalink
Removed unnecessary using statements and cleaned up google/non-google…
Browse files Browse the repository at this point in the history
… distinction
  • Loading branch information
theraysmith committed Jul 19, 2017
1 parent cec1037 commit 3f77354
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 37 deletions.
6 changes: 1 addition & 5 deletions training/boxchar.h
Expand Up @@ -27,11 +27,7 @@
#include <vector>

#include "allheaders.h" // from Leptonica

#ifdef USE_STD_NAMESPACE
using std::string;
using std::vector;
#endif
#include "platform.h"

struct Box;

Expand Down
4 changes: 2 additions & 2 deletions training/classifier_tester.cpp
Expand Up @@ -17,9 +17,9 @@
// Author: Ray Smith

#include <stdio.h>
#ifndef USE_STD_NAMESPACE
#ifdef GOOGLE_TESSERACT
#include "base/commandlineflags.h"
#endif // USE_STD_NAMESPACE
#endif // GOOGLE_TESSERACT
#include "baseapi.h"
#include "commontraining.h"
#include "mastertrainer.h"
Expand Down
2 changes: 1 addition & 1 deletion training/commandlineflags.cpp
Expand Up @@ -9,7 +9,7 @@
// limitations under the License.
#include "commandlineflags.h"

#ifdef USE_STD_NAMESPACE
#ifndef GOOGLE_TESSERACT

namespace tesseract {
bool IntFlagExists(const char* flag_name, inT32* value) {
Expand Down
2 changes: 1 addition & 1 deletion training/commandlineflags.h
Expand Up @@ -19,7 +19,7 @@
#ifndef TESSERACT_TRAINING_COMMANDLINEFLAGS_H_
#define TESSERACT_TRAINING_COMMANDLINEFLAGS_H_

#ifdef USE_STD_NAMESPACE
#ifndef GOOGLE_TESSERACT

#include <stdlib.h>
#include "tprintf.h"
Expand Down
4 changes: 1 addition & 3 deletions training/fileio.h
Expand Up @@ -21,9 +21,7 @@
#include <cstdio>
#include <string>

#ifdef USE_STD_NAMESPACE
using std::string;
#endif
#include "platform.h"

namespace tesseract {

Expand Down
2 changes: 1 addition & 1 deletion training/lstmeval.cpp
Expand Up @@ -16,7 +16,7 @@
// limitations under the License.
///////////////////////////////////////////////////////////////////////

#ifndef USE_STD_NAMESPACE
#ifdef GOOGLE_TESSERACT
#include "base/commandlineflags.h"
#endif
#include "commontraining.h"
Expand Down
2 changes: 1 addition & 1 deletion training/lstmtraining.cpp
Expand Up @@ -16,7 +16,7 @@
// limitations under the License.
///////////////////////////////////////////////////////////////////////

#ifndef USE_STD_NAMESPACE
#ifdef GOOGLE_TESSERACT
#include "base/commandlineflags.h"
#endif
#include "commontraining.h"
Expand Down
4 changes: 2 additions & 2 deletions training/pango_font_info.cpp
Expand Up @@ -49,7 +49,7 @@
STRING_PARAM_FLAG(fontconfig_tmpdir, "/tmp",
"Overrides fontconfig default temporary dir");

#ifndef USE_STD_NAMESPACE
#ifdef GOOGLE_TESSERACT
#include "ocr/trainingdata/typesetting/legacy_fonts.h"
BOOL_PARAM_FLAG(use_only_legacy_fonts, false,
"Overrides --fonts_dir and sets the known universe of fonts to"
Expand Down Expand Up @@ -544,7 +544,7 @@ const std::vector<string>& FontUtils::ListAvailableFonts() {
if (!available_fonts_.empty()) {
return available_fonts_;
}
#ifndef USE_STD_NAMESPACE
#ifdef GOOGLE_TESSERACT
if (FLAGS_use_only_legacy_fonts) {
// Restrict view to list of fonts in legacy_fonts.h
tprintf("Using list of legacy fonts only\n");
Expand Down
2 changes: 1 addition & 1 deletion training/shapeclustering.cpp
Expand Up @@ -20,7 +20,7 @@
#include "config_auto.h"
#endif

#ifndef USE_STD_NAMESPACE
#ifdef GOOGLE_TESSERACT
#include "base/commandlineflags.h"
#endif
#include "commontraining.h"
Expand Down
7 changes: 0 additions & 7 deletions training/stringrenderer.cpp
Expand Up @@ -39,13 +39,6 @@
#include "unicode/uchar.h" // from libicu
#include "util.h"

#ifdef USE_STD_NAMESPACE
using std::map;
using std::max;
using std::min;
using std::swap;
#endif

namespace tesseract {

static const int kDefaultOutputResolution = 300;
Expand Down
6 changes: 0 additions & 6 deletions training/text2image.cpp
Expand Up @@ -50,12 +50,6 @@
#include "unicharset.h"
#include "util.h"

#ifdef USE_STD_NAMESPACE
using std::make_pair;
using std::map;
using std::pair;
#endif

// A number with which to initialize the random number generator.
const int kRandomSeed = 0x18273645;

Expand Down
4 changes: 1 addition & 3 deletions training/unicharset_training_utils.h
Expand Up @@ -22,9 +22,7 @@

#include <string>

#ifdef USE_STD_NAMESPACE
using std::string;
#endif
#include "platform.h"

class STATS;
class UNICHARSET;
Expand Down
5 changes: 1 addition & 4 deletions training/util.h
Expand Up @@ -25,10 +25,7 @@
#include <string>
#include <vector>

#ifdef USE_STD_NAMESPACE
using std::string;
using std::vector;
#endif
#include "platform.h"

// StringHash is the hashing functor needed by the stl hash map.
#ifndef COMPILER_MSVC
Expand Down

1 comment on commit 3f77354

@amitdo
Copy link
Collaborator

@amitdo amitdo commented on 3f77354 Jul 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Ray,
What about this one:

#ifndef USE_STD_NAMESPACE

#ifndef USE_STD_NAMESPACE ->
#ifdef GOOGLE_TESSERACT
?

Please sign in to comment.