Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
base::SimpleToken Class Reference

#include <simple_token.h>

Public Member Functions

 SimpleToken ()=default
 
 ~SimpleToken ()=default
 
 SimpleToken (const std::string &token)
 
std::string ToString () const
 
constexpr operator bool () const
 
constexpr bool operator< (const SimpleToken &other) const
 
constexpr bool operator== (const SimpleToken &other) const
 
constexpr bool operator!= (const SimpleToken &other) const
 

Static Public Member Functions

static SimpleToken Create ()
 

Detailed Description

Definition at line 15 of file simple_token.h.

Constructor & Destructor Documentation

◆ SimpleToken() [1/2]

base::SimpleToken::SimpleToken ( )
default

◆ ~SimpleToken()

base::SimpleToken::~SimpleToken ( )
default

◆ SimpleToken() [2/2]

base::SimpleToken::SimpleToken ( const std::string &  token)

Definition at line 14 of file simple_token.cc.

14: token_(token) {}

Member Function Documentation

◆ Create()

SimpleToken base::SimpleToken::Create ( )
static

Definition at line 17 of file simple_token.cc.

17 {
18 const char charset[] =
19 "0123456789"
20 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
21 "abcdefghijklmnopqrstuvwxyz";
22 const size_t max_index = (sizeof(charset) - 1);
23
24 std::string str;
25 for (size_t i = 0; i < kRandomTokenLength; i++) {
26 str.push_back(charset[rand() % max_index]);
27 }
28 return SimpleToken(str);
29}
SimpleToken()=default
constexpr size_t kRandomTokenLength
Definition: simple_token.cc:12

◆ operator bool()

constexpr base::SimpleToken::operator bool ( ) const
inlineexplicitconstexpr

Definition at line 30 of file simple_token.h.

30{ return !token_.empty(); }

◆ operator!=()

constexpr bool base::SimpleToken::operator!= ( const SimpleToken other) const
inlineconstexpr

Definition at line 40 of file simple_token.h.

40 {
41 return !(*this == other);
42 }

◆ operator<()

constexpr bool base::SimpleToken::operator< ( const SimpleToken other) const
inlineconstexpr

Definition at line 32 of file simple_token.h.

32 {
33 return token_.compare(other.token_) < 0;
34 }

◆ operator==()

constexpr bool base::SimpleToken::operator== ( const SimpleToken other) const
inlineconstexpr

Definition at line 36 of file simple_token.h.

36 {
37 return token_.compare(other.token_) == 0;
38 }

◆ ToString()

std::string base::SimpleToken::ToString ( ) const
inline

Definition at line 28 of file simple_token.h.

28{ return token_; }

The documentation for this class was generated from the following files: