NCBI C++ ToolKit
Public Types | Static Public Member Functions | Static Private Member Functions | Static Private Attributes | List of all members
CCountries Class Reference

Search Toolkit Book for CCountries

#include <objects/seqfeat/SubSource.hpp>

Public Types

enum  EStateCleanup {
  e_NoResult = 0 , e_Valid = 1 , e_Corrected = 2 , e_Ambiguous = 3 ,
  e_Missing = 4 , e_NotUSA = 5
}
 
typedef CStaticPairArrayMap< const char *, const char *, PCase_CStrTCStringPairsMap
 
typedef map< string, string, PNocaseTUsaExceptionMap
 

Static Public Member Functions

static bool IsValid (const string &country)
 
static bool IsValid (const string &country, bool &is_miscapitalized)
 
static bool WasValid (const string &country)
 
static bool WasValid (const string &country, bool &is_miscapitalized)
 
static string CapitalizeFirstLetterOfEveryWord (const string &phrase)
 
static string WholeCountryFix (string country)
 
static bool IsSubstringOfStringInList (const string &phrase, const string &country1, size_t pos1)
 
static bool ContainsMultipleCountryNames (const string &phrase)
 
static string GetCorrectedCountryCapitalization (const string &country)
 
static string NewFixCountry (const string &input, bool us_territories=false)
 
static bool ChangeExtraColonsToCommas (string &country)
 
static string CountryFixupItem (const string &input, bool capitalize_after_colon)
 
static void ReadUSAExceptionMap (TUsaExceptionMap &exceptions, const string &filepath)
 
static void LoadUSAExceptionMap (const TUsaExceptionMap &exceptions)
 
static void LoadUSAExceptionMap (const string &exception_file)
 
static string USAStateCleanup (const string &country)
 
static string USAStateCleanup (const string &country, EStateCleanup &type)
 

Static Private Member Functions

static void x_RemoveDelimitersFromEnds (string &val, bool except_paren=false)
 
static vector< stringx_Tokenize (const string &val)
 
static void x_FindCountryName (const TCStringPairsMap &fix_map, const vector< string > &countries, string &valid_country, string &orig_valid_country, bool &too_many_countries, bool &bad_cap)
 

Static Private Attributes

static const string sm_Countries []
 
static const string sm_Former_Countries []
 

Detailed Description

Definition at line 282 of file SubSource.hpp.

Member Typedef Documentation

◆ TCStringPairsMap

Definition at line 307 of file SubSource.hpp.

◆ TUsaExceptionMap

Definition at line 309 of file SubSource.hpp.

Member Enumeration Documentation

◆ EStateCleanup

Enumerator
e_NoResult 
e_Valid 
e_Corrected 
e_Ambiguous 
e_Missing 
e_NotUSA 

Definition at line 286 of file SubSource.hpp.

Member Function Documentation

◆ CapitalizeFirstLetterOfEveryWord()

string CCountries::CapitalizeFirstLetterOfEveryWord ( const string phrase)
static

Definition at line 3851 of file SubSource.cpp.

References isalpha(), NStr::Join(), NStr::Split(), and toupper().

Referenced by CountryFixupItem().

◆ ChangeExtraColonsToCommas()

bool CCountries::ChangeExtraColonsToCommas ( string country)
static

Definition at line 4794 of file SubSource.cpp.

References i.

Referenced by NewFixCountry().

◆ ContainsMultipleCountryNames()

bool CCountries::ContainsMultipleCountryNames ( const string phrase)
static

Definition at line 3901 of file SubSource.cpp.

References NStr::FindNoCase(), isalpha(), IsSubstringOfStringInList(), ITERATE, NPOS, and s_CountriesSet.

Referenced by NewFixCountry().

◆ CountryFixupItem()

string CCountries::CountryFixupItem ( const string input,
bool  capitalize_after_colon 
)
static

◆ GetCorrectedCountryCapitalization()

string CCountries::GetCorrectedCountryCapitalization ( const string country)
static

Definition at line 3921 of file SubSource.cpp.

References NStr::EqualNocase(), ITERATE, output, and s_CountriesSet.

Referenced by NewFixCountry().

◆ IsSubstringOfStringInList()

bool CCountries::IsSubstringOfStringInList ( const string phrase,
const string country1,
size_t  pos1 
)
static

Definition at line 3881 of file SubSource.cpp.

References NStr::FindNoCase(), ITERATE, NPOS, r(), and s_CountriesSet.

Referenced by ContainsMultipleCountryNames().

◆ IsValid() [1/2]

bool CCountries::IsValid ( const string country)
static

◆ IsValid() [2/2]

bool CCountries::IsValid ( const string country,
bool is_miscapitalized 
)
static

◆ LoadUSAExceptionMap() [1/2]

void CCountries::LoadUSAExceptionMap ( const string exception_file)
static

Definition at line 4617 of file SubSource.cpp.

References LoadUSAExceptionMap(), and ReadUSAExceptionMap().

◆ LoadUSAExceptionMap() [2/2]

void CCountries::LoadUSAExceptionMap ( const TUsaExceptionMap exceptions)
static

◆ NewFixCountry()

string CCountries::NewFixCountry ( const string input,
bool  us_territories = false 
)
static

◆ ReadUSAExceptionMap()

void CCountries::ReadUSAExceptionMap ( CCountries::TUsaExceptionMap exceptions,
const string filepath 
)
static

Definition at line 4577 of file SubSource.cpp.

References row.

Referenced by LoadUSAExceptionMap().

◆ USAStateCleanup() [1/2]

string CCountries::USAStateCleanup ( const string country)
static

Definition at line 4656 of file SubSource.cpp.

References e_NoResult.

Referenced by NewFixCountry(), and s_USAStateTest().

◆ USAStateCleanup() [2/2]

string CCountries::USAStateCleanup ( const string country,
CCountries::EStateCleanup type 
)
static

◆ WasValid() [1/2]

bool CCountries::WasValid ( const string country)
static

◆ WasValid() [2/2]

bool CCountries::WasValid ( const string country,
bool is_miscapitalized 
)
static

◆ WholeCountryFix()

string CCountries::WholeCountryFix ( string  country)
static

Definition at line 3861 of file SubSource.cpp.

References NStr::EqualNocase(), i, s_USAStates, and NStr::ToLower().

Referenced by NewFixCountry().

◆ x_FindCountryName()

void CCountries::x_FindCountryName ( const TCStringPairsMap fix_map,
const vector< string > &  countries,
string valid_country,
string orig_valid_country,
bool too_many_countries,
bool bad_cap 
)
staticprivate

◆ x_RemoveDelimitersFromEnds()

void CCountries::x_RemoveDelimitersFromEnds ( string val,
bool  except_paren = false 
)
staticprivate

◆ x_Tokenize()

vector< string > CCountries::x_Tokenize ( const string val)
staticprivate

Definition at line 3983 of file SubSource.cpp.

References NStr::Find(), first(), NPOS, NStr::Split(), and val.

Referenced by NewFixCountry().

Member Data Documentation

◆ sm_Countries

const string CCountries::sm_Countries[]
staticprivate

Definition at line 317 of file SubSource.hpp.

◆ sm_Former_Countries

const string CCountries::sm_Former_Countries[]
staticprivate

Definition at line 318 of file SubSource.hpp.


The documentation for this class was generated from the following files:
Modified on Tue Apr 30 06:37:54 2024 by modify_doxy.py rev. 669887