Skip to content

Commit

Permalink
ParsingOptions update (non functional)
Browse files Browse the repository at this point in the history
  • Loading branch information
KarolJakubKrawiec committed Jan 24, 2025
1 parent 1a8629e commit ddcfb51
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 41 deletions.
1 change: 1 addition & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ set (
"src/phonenumbers/base/strings/string_piece.cc"
"src/phonenumbers/default_logger.cc"
"src/phonenumbers/logger.cc"
"src/phonenumbers/parsingoptions.cc"
"src/phonenumbers/phonemetadata.pb.cc" # Generated by Protocol Buffers.
"src/phonenumbers/phonenumber.cc"
"src/phonenumbers/phonenumber.pb.cc" # Generated by Protocol Buffers.
Expand Down
6 changes: 2 additions & 4 deletions cpp/src/phonenumbers/parsingoptions.cc
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#include "i18n/phonenumbers/parsingoptions.h"

#include "phonenumbers/region_code.h"
#include "phonenumbers/parsingoptions.h"

namespace i18n {
namespace phonenumbers {

ParsingOptions& ParsingOptions::SetDefaultRegion(
const string& default_region) {
const std::string& default_region) {
default_region_ = default_region;
return *this;
}
Expand Down
10 changes: 5 additions & 5 deletions cpp/src/phonenumbers/parsingoptions.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef I18N_PHONENUMBERS_PARSINGOPTIONS_H_
#define I18N_PHONENUMBERS_PARSINGOPTIONS_H_

#include "phonenumbers/test_util.h"
#include <string>

namespace i18n {
namespace phonenumbers {
Expand All @@ -12,11 +12,11 @@ namespace phonenumbers {
// ParsingOptions().SetDefaultRegion(RegionCode::US()).SetKeepRawInput(true);
class ParsingOptions {
public:
ParsingOptions() = default;
ParsingOptions() : default_region_("ZZ"), keep_raw_input_(false) {};

// Set the value for default_region_.
ParsingOptions& SetDefaultRegion(
const string& default_region);
const std::string& default_region);

// Set the value for keep_raw_input_.
ParsingOptions& SetKeepRawInput(bool keep_raw_input);
Expand All @@ -29,11 +29,11 @@ class ParsingOptions {
// format, the country_code will be set to the one of this default region. If
// the number is guaranteed to start with a '+' followed by the country
// calling code, then RegionCode.ZZ or null can be supplied.
const string& default_region_ = RegionCode::ZZ();
std::string default_region_;

// Whether the raw input should be kept in the PhoneNumber object. If true,
// the raw_input field and country_code_source fields will be populated.
bool keep_raw_input_ = false;
bool keep_raw_input_;
};

} // namespace phonenumbers
Expand Down
1 change: 1 addition & 0 deletions cpp/src/phonenumbers/region_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ using std::string;

class RegionCode {
public:

// Returns a region code string representing the "unknown" region.
static const char* GetUnknown() {
return ZZ();
Expand Down
2 changes: 1 addition & 1 deletion cpp/test/phonenumbers/asyoutypeformatter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ TEST_F(AsYouTypeFormatterTest, ConvertUnicodeStringPosition) {
}

TEST_F(AsYouTypeFormatterTest, Constructor) {
formatter_.reset(phone_util_.GetAsYouTypeFormatter(const RegionCode::US()));
formatter_.reset(phone_util_.GetAsYouTypeFormatter(RegionCode::US()));

EXPECT_TRUE(GetCurrentMetadata() != NULL);
}
Expand Down
Loading

0 comments on commit ddcfb51

Please sign in to comment.