Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: device/bluetooth/uribeacon/uri_encoder.h

Issue 950083003: device/bluetooth: Implemented UriBeacon decoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef DEVICE_BLUETOOTH_URIBEACON_URI_ENCODER_H_
6 #define DEVICE_BLUETOOTH_URIBEACON_URI_ENCODER_H_
7
8 #include <string>
9
10 #include "base/strings/string_piece.h"
11
12 namespace device {
13
14 // The following functions EncodeUriBeaconUri() and DecodeUriBeaconUri() helps
15 // encoding/decoding URI with the UriBeacon encoding.
16 //
17 // Example usage:
18 //
19 // std::vector<uint8_t> encoded;
20 // EncodeUriBeaconUri("http://web.mit.edu/", encoded)
21 // // encoded -> {2, 'w', 'e', 'b', '.', 'm', 'i', 't', 2}
22 //
23 // const char encodedUri[] = {0, 'u', 'r', 'i', 'b', 'e', 'a', 'c', 'o', 'n',
24 // 8};
25 // const std::vector<uint8_t> kEncodedUri(encodedUri, encodedUri +
26 // sizeof(encodedUri));
27 // std::string decoded;
28 // DecodeUriBeaconUri(kEncodedUri, decoded)
29 // // decoded -> "http://uribeacon.org"
30
31 // Encodes the input string using URI encoding described in UriBeacon
32 // specifications. |input| must be ASCII characters.
33 void EncodeUriBeaconUri(const std::string& input, std::vector<uint8_t>& output);
34
35 // Decodes the input string using URI encoding described in UriBeacon
36 // specifications.
37 void DecodeUriBeaconUri(const std::vector<uint8_t>& input, std::string& output);
38
39 } // namespace device
40
41 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698