1 // Author: Bruce Allen
2 // Created: 2/25/2013
3 //
4 // The software provided here is released by the Naval Postgraduate
5 // School, an agency of the U.S. Department of Navy. The software
6 // bears no warranty, either expressed or implied. NPS does not assume
7 // legal liability nor responsibility for a User's use of the software
8 // or the results of such use.
9 //
10 // Please note that within the United States, copyright protection,
11 // under Section 105 of the United States Code, Title 17, is not
12 // available for any work of the United States Government and/or for
13 // any works created by United States Government employees. User
14 // acknowledges that this software contains work which was created by
15 // NPS government employees and is therefore in the public domain and
16 // not subject to copyright.
17 //
18 // Released into the public domain on February 25, 2013 by Bruce Allen.
19
20 // Adapted from bulk_extractor/src/be13_api/sbuf.h
21 /**
22 * \file
23 * String to uint64_t.
24 */
25
26 #ifndef TO_UINT64
27 #define TO_UINT64
28
29 #include <iostream>
30 #include <string>
31 #include <sstream>
32
33 // string to uint64_t
s_to_uint64(std::string str)34 inline uint64_t s_to_uint64(std::string str)
35 {
36 int64_t val(0);
37 std::istringstream ss(str);
38 ss >> val;
39 return val;
40 }
41
42 #endif
43
44