The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Namespaces | Classes | Typedefs | Functions | Variables
util Namespace Reference

Namespaces

 detail
 

Classes

struct  close_FILE
 This class specializes the scoped_resource to implement scoped FILEs. More...
 
class  const_iterator_extend
 This is a const_iterator class that extends an existing const_iterator by overriding dereference. More...
 
struct  delete_array
 A helper policy for scoped_array. More...
 
struct  delete_item
 A helper policy for scoped_ptr. More...
 
class  iterator_extend
 This is an iterator class that extends an existing iterator by overriding dereference. More...
 
struct  scoped_array
 This class has identical behavior to scoped_ptr, except it manages heap-allocated arrays instead of heap-allocated single objects. More...
 
struct  scoped_ptr
 A class which implements an approximation of template<typename T> typedef scoped_resource<T*,delete_item> scoped_ptr<T>;. More...
 
class  scoped_resource
 A class template, scoped_resource, designed to implement the Resource Acquisition Is Initialization (RAII) approach to resource management. More...
 
class  unique_ptr
 

Typedefs

typedef scoped_resource
< std::FILE *, close_FILE
scoped_FILE
 

Functions

std::string format_time_summary (time_t t)
 
std::array< uint8_t, 16 > md5 (const std::string &input)
 Returns the MD5 digest for the specified input. More...
 
int get_iteration_count (const std::string &hash)
 
std::string get_salt (const std::string &hash)
 
bool is_valid_hash (const std::string &hash)
 
std::string encode_hash (const std::array< uint8_t, 16 > &input)
 
std::string create_hash (const std::string &password, const std::string &salt, int iteration_count)
 
size_t strftime (char *str, size_t count, const std::string &format, const std::tm *time)
 
template<typename Container , typename Value >
bool contains (const Container &container, const Value &value)
 Returns true iff value is found in container. More...
 

Variables

const std::string itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
 
const std::string hash_prefix = "$H$"
 

Typedef Documentation

Definition at line 190 of file scoped_resource.hpp.

Function Documentation

template<typename Container , typename Value >
bool util::contains ( const Container &  container,
const Value value 
)
inline

Returns true iff value is found in container.

This should work whenever Container "looks like" an STL container of Values. Normally this uses std::find(), but a simulated partial template specialization exists when Value is Container::key_type. In this case, Container is assumed an associative container, and the member function find() is used.

Definition at line 489 of file util.hpp.

References util::detail::contains_impl< Container, Value >::eval().

Referenced by actions::check_recruit_location(), events::menu_handler::do_recruit(), and actions::undo::recruit_action::redo().

std::string util::create_hash ( const std::string password,
const std::string salt,
int  iteration_count 
)

Definition at line 74 of file hash.cpp.

References encode_hash(), md5(), and output.

Referenced by open_connection().

std::string util::encode_hash ( const std::array< uint8_t, 16 > &  input)

Definition at line 51 of file hash.cpp.

References i.

Referenced by create_hash(), and ng::scenario::create_image_surface().

std::string util::format_time_summary ( time_t  t)
int util::get_iteration_count ( const std::string hash)

Definition at line 33 of file hash.cpp.

Referenced by is_valid_hash(), and open_connection().

std::string util::get_salt ( const std::string hash)

Definition at line 37 of file hash.cpp.

Referenced by open_connection().

bool util::is_valid_hash ( const std::string hash)

Definition at line 41 of file hash.cpp.

References get_iteration_count(), and hash_prefix.

std::array< uint8_t, 16 > util::md5 ( const std::string input)

Returns the MD5 digest for the specified input.

Note
The returned value points to a fixed-size 16 bytes array representing the raw MD5 value, not a null-terminated string. Use encode_hash if you need the text representation instead.

Definition at line 26 of file hash.cpp.

References MD5::finalize(), MD5::raw_digest(), and MD5::update().

Referenced by create_hash(), and ng::scenario::create_image_surface().

size_t util::strftime ( char *  str,
size_t  count,
const std::string format,
const std::tm *  time 
)

Variable Documentation

const std::string util::hash_prefix = "$H$"

Definition at line 24 of file hash.cpp.

Referenced by is_valid_hash().

const std::string util::itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"

Definition at line 23 of file hash.cpp.