aboutsummaryrefslogtreecommitdiff
path: root/cpp
AgeCommit message (Collapse)Author
2014-06-10Update to Turkish formatting data/fieldslararennie@google.com
git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@273 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-06-10Updating region_data_constants.cc with the correct postal URL for AR and a ↵lararennie@google.com
format change cfor zh-Latn. git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@272 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-06-06Add a comment about valid language tags in address_input_helper.h.rouslan@chromium.org
R=lararennie@google.com Review URL: https://codereview.appspot.com/103070043 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@268 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-06-05RuleHierarchy should be forward-declared as a struct.rouslan@chromium.org
Some compilers do not like a forward declaration: class RuleHierarchy; ..followed by the actual declaration: struct RuleHierarchy {...}; TBR=roubert@google.com Review URL: https://codereview.appspot.com/109740044 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@267 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-06-05Point to the new location of RE2 library.rouslan@chromium.org
The http://packages.debian.org/experimental/libre2-dev URL is no longer valid. You now can get the RE2 library from: http://packages.ubuntu.com/utopic/libre2-dev. TBR=roubert@google.com Review URL: https://codereview.appspot.com/103910045 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@266 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-06-04Make IsFieldRequired and IsFieldUsed always return true for COUNTRY.roubert@google.com
Author: davinci@google.com git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@265 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-06-04Break implementation of MockDownloader out into a stand-alone class.roubert@google.com
R=lararennie@google.com BUG= Review URL: https://codereview.appspot.com/105790043 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@264 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-06-04Rename Synonyms class to AddressNormalizerlararennie@google.com
git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@263 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-06-03Functionality to guess fields in an address based on existing data. Adds a ↵lararennie@google.com
post-code if possible, otherwise if one is present, tries to fill in state, locality and dep-locality. git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@262 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-06-03Change the methods in validation_task.cc to use the required and used fields ↵roubert@google.com
information from statically linked region_data_constants. git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@261 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-30Break implementation out of the public OndemandSupplier interface.roubert@google.com
The current situation, where OndemandSupplier has a nested class which is a RuleHierarchy, is an artefact from the time when OndemandSupplier was an internal interface (r244). It does no longer make any sense. This change makes Supplier::RuleHierarchy a simple struct and moves all the implementation details into an internal class OndemandSupplyTask. R=rouslan@chromium.org BUG= Review URL: https://codereview.appspot.com/101960046 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@260 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-30Remove hardcoded STREET_ADDRESS in AddressData::IsRepeatedFieldValue().roubert@google.com
Instead of this particular field hardcoded, look the field up in the kVectorStringField table to see whether GetRepeatedFieldValue() would succeed for the field requested. R=rouslan@chromium.org BUG= Review URL: https://codereview.appspot.com/101960045 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@259 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-29Add more tests for RegionDataBuilder.rouslan@chromium.org
This patch adds more tests for RegionDataBuilder to verify the behavior as it's documented in the comment for RegionDataBuilder::Build() method. TBR=roubert@google.com Review URL: https://codereview.appspot.com/101990043 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@258 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-28Separate region data builder from preload supplier.rouslan@chromium.org
R=roubert@google.com Review URL: https://codereview.appspot.com/101830044 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@256 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-28Add feature for selecting basictypes.h implementation at build time.roubert@google.com
If building libaddressinput in an environment where there already is another implementation of the basictypes.h header file (like in Chromium), then this change will make it possible to pass the command line flag -DI18N_ADDRESSINPUT_USE_BASICTYPES_OVERRIDE=1 to the compiler and provide a file named basictypes_override.h, in a location where the compiler will look for it, which provides the desired implementation. This also makes it possible to remove the work-around for basictypes.h in re2ptr.h as any environment where re2.h includes its own basictypes.h now will be able to have all of libaddressinput use that implementation. R=rouslan@chromium.org BUG= Review URL: https://codereview.appspot.com/99490045 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@255 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-28Remove extra whitespace from messages.rouslan@chromium.org
This patch removes the extra whitespace from English strings. After this patch lands, Chrome can pull in the strings and start the translation process. R=lararennie@google.com, roubert@google.com Review URL: https://codereview.appspot.com/92660044 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@254 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-27Remove deprecated AddressValidator constructor.roubert@google.com
R=rouslan@chromium.org BUG= Review URL: https://codereview.appspot.com/101760044 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@253 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-27Address outstanding comments from codereview.appspot.com/100630043.keghani@google.com
git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@252 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-26Delete unused call to ChooseBestAddressLanguage().roubert@google.com
This has been left over from an earlier version of this code, in which this was used to set region_address.language_code (which is now left unset). R=rouslan@chromium.org BUG= Review URL: https://codereview.appspot.com/101730045 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@251 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-23Synonym resolution.rouslan@chromium.org
R=roubert@google.com Review URL: https://codereview.appspot.com/98460048 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@250 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-23Build a tree of sub-regions, useful for dropdowns in UI, for example.rouslan@chromium.org
R=roubert@google.com Review URL: https://codereview.appspot.com/100630048 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@249 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-23Convert libaddressinput validation error codes into error messages.keghani@google.com
git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@248 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-23Improvements to rule, language, and lookup key objects.rouslan@chromium.org
- Add Latin name and name to rule. - Move language guessing to language object. - Create child lookup objects. R=lararennie@google.com Review URL: https://codereview.appspot.com/96560045 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@247 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-23Canonical header guard name.rouslan@chromium.org
git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@246 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-23Remove unnecessary include.rouslan@chromium.org
TBR=lararennie@google.com Review URL: https://codereview.appspot.com/97650047 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@245 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-23Move ondemand_supplier.h to become a public header file.roubert@google.com
With OndemandSupplier public, users of libaddressinput can choose to create either OndemandSupplier or PreloadSupplier objects to use when some Supplier object is needed. R=rouslan@chromium.org BUG= Review URL: https://codereview.appspot.com/98450049 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@244 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-23Synchronous API to get a Rule for a LookupKey.rouslan@chromium.org
R=lararennie@google.com Review URL: https://codereview.appspot.com/95550047 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@243 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-23Deprecate old AddressValidator constructor.roubert@google.com
In the future, AddressValidator objects should always be constructed by passing a pointer to an existing object that implements the Supplier interface (and never construct its own Supplier internally). R=rouslan@chromium.org BUG= Review URL: https://codereview.appspot.com/92550048 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@242 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-22Change IsFieldRequired and IsFieldUsed to use statically linkedroubert@google.com
region_data_constants, rather than the metadata from the server. This is possible now since region_data_constants is autogenerated and can be depended on to be up-to-date (r206). git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@241 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-22Update region_data_constants.cc with zipex and posturl fields.keghani@google.com
git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@240 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-22Rename class MetadataLoader to class OndemandSupplier.roubert@google.com
With this class now being an implementation of the Supplier interface (r235) this new name better reflects that fact and its relationship to PreloadSupplier (r236) and corresponds to the class comment: An implementation of the Supplier interface that owns a Retriever object, through which it loads address metadata as needed, creating Rule objects and caching these. R=rouslan@chromium.org BUG= Review URL: https://codereview.appspot.com/96540048 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@239 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-22Parametrize AddressValidatorTest on Supplier to test them all.roubert@google.com
The test fixture is parametrized to be executed with different wrappers that provide different Supplier implementations. This verifies that both MetadataLoader and PreloadSupplier give the same results when used for address validation. In order to do this, add a constructor that takes Supplier* to AddressValidator. R=rouslan@chromium.org BUG= Review URL: https://codereview.appspot.com/97640045 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@238 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-22Move base tests from MetadataLoaderTest to SupplierTest.roubert@google.com
Those tests in MetadataLoaderTest that should hold for all implementations of the Supplier interface are moved into a new test fixture Supplier, which is parametrized to be executed with different wrappers that provide different Supplier implementations. This verifies that both MetadataLoader and PreloadSupplier implement this base functionality with the same results. R=lararennie@google.com, rouslan@chromium.org BUG= Review URL: https://codereview.appspot.com/92560044 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@237 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-22Add class PreloadSupplier, implementing the Supplier interface.roubert@google.com
PreloadSupplier owns a Retriever object, through which it can load aggregated address metadata for a region when instructed to, creating Rule objects and caching these. It also provides methods to check whether metadata for a particular region is already loaded or in progress of being loaded. When using a PreloadSupplier, it becomes possible to do synchronous address validation using an asynchronous Downloader, and to have full control over when network access is being done. R=rouslan@chromium.org BUG= Review URL: https://codereview.appspot.com/94700044 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@236 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-22Break out abstract base class Supplier from MetadataLoader.roubert@google.com
To make it possible to supply the AddressValidator with address metadata in several different way, an interface for such a Supplier is defined and the existing MetadataLoader is refactored to implement it. This will be used to implement another Supplier that doesn't load any data on demand, but only works with preloaded data. R=rouslan@chromium.org BUG= Review URL: https://codereview.appspot.com/97650044 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@235 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-22Add the utility function RegionDataConstants::IsSupported().roubert@google.com
This provides the same functionality as iterating through the list of region codes returned by RegionDataConstants::GetRegionCodes() to check whether a particular region code is supported by the library, but much more efficient. R=rouslan@chromium.org BUG= Review URL: https://codereview.appspot.com/95590043 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@234 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-22Adding missing includes for address formatter.lararennie@google.com
git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@233 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-22Adding address formatting functionality - on a single line, on multiple ↵lararennie@google.com
lines, and combining multiple street address lines into one, in a language-dependent fashion. git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@232 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-21Enable aggregate data in fake downloader.rouslan@chromium.org
This patch changes fake data URL from test:/// to test:///plain/ and adds a URL for fake aggregate data: test:///aggregate/. Example of data at test:///plain/data/ZW: {"name": "ZIMBABWE", "key": "ZW", "id": "data/ZW"} Example of aggregate data at test:///aggregate/data/ZW: {"data/ZW": {"name": "ZIMBABWE", "key": "ZW", "id": "data/ZW"}} This behavior mimics the behavior of the server URLs https://i18napis.appspot.com/ssl-address/data/ and https://i18napis.appspot.com/ssl-aggregate-address/data/. R=lararennie@google.com Review URL: https://codereview.appspot.com/95560045 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@231 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-21Enable parsing a Rule object from a JSON object.rouslan@chromium.org
TBR=roubert@google.com Review URL: https://codereview.appspot.com/92520047 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@230 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-21Enable retrieving a list of keys from JSON.rouslan@chromium.org
TBR=roubert@google.com Review URL: https://codereview.appspot.com/92520046 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@229 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-21Use stale data if a download fails.rouslan@chromium.org
If a download of validation rules fails, but stale data is available, then re-use it. Stale data is valid data that is more than 30 days old. Valid data is data with a correct checksum. Review URL: https://codereview.appspot.com/95500044 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@228 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-21Changing parsing of format strings to return FormatElement.lararennie@google.com
git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@227 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-20Some fixups in string util.rouslan@chromium.org
Review URL: https://codereview.appspot.com/97600043 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@226 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-20Streamline string_util to keep only our relevant functions and add unit tests.keghani@google.com
git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@225 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-20Add loose string compare.rouslan@chromium.org
This patch is necessary for implementing synonym lookups. R=roubert@google.com Review URL: https://codereview.appspot.com/92440044 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@224 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-20Nested dictionaries for parsing aggregate data.rouslan@chromium.org
R=roubert@google.com Review URL: https://codereview.appspot.com/97580043 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@223 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-20Copy string_util from Chromium to libaddressinput.keghani@google.com
git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@222 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-19Check that admin area and postal code name types map to UI strings.rouslan@chromium.org
R=lararennie@google.com Review URL: https://codereview.appspot.com/91500047 git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@221 38ededc0-08b8-5190-f2ac-b31f878777ad
2014-05-16Adding support of language code in lookup keys (extracted from the address).dbeaumont@google.com
git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@218 38ededc0-08b8-5190-f2ac-b31f878777ad