summaryrefslogtreecommitdiffstats
path: root/content/common/android/address_parser.h
blob: 1a12a32c14d3a947cb84932cf533819be00e2945 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_COMMON_ADDRESS_PARSER_H_
#define CONTENT_COMMON_ADDRESS_PARSER_H_

#include "base/strings/string16.h"
#include "content/common/content_export.h"

namespace content {

// Provides methods to find a geographical address (currently US only)
// in a given text string.
namespace address_parser {

// Find the first address in some chunk of text.  If an address is found in
// |text| true is returned and the address is copied into |address|.
// Otherwise, false is returned.
bool FindAddress(const base::string16& text, base::string16* address);

// Find the first address in some chunk of test.  |begin| is the starting
// position to search from, |end| is the position to search to.  |start_pos|
// and |end_pos| are set to the starting and ending position of the address,
// if found.
CONTENT_EXPORT bool FindAddress(const base::string16::const_iterator& begin,
                                const base::string16::const_iterator& end,
                                size_t* start_pos,
                                size_t* end_pos);

}  // namespace address_parser

}  // namespace content

#endif  // CONTENT_COMMON_ADDRESS_PARSER_H_