Proton
1.1.1
Make porting easy from Python to C++11
|
The main proton namespace. More...
Namespaces | |
namespace | detail |
The implementation namespace of proton. |
Classes | |
class | err |
The exception class. More... | |
class | deque_ |
a deque extension implementing python's list-like interfaces. More... | |
struct | fo_< retT(argT...)> |
functor interface for function object classes. More... | |
class | map_ |
a map extension implementing python's dict-like interfaces. More... | |
class | mem_pool |
the main memory pool. More... | |
class | smart_allocator |
An extended allocator using memory pool. More... | |
struct | ref_ |
The core reference support template. More... | |
struct | key_hash |
general key_hash for refs. More... | |
struct | subkey_hash |
general subkey_hash for refs. More... | |
class | set_ |
a set extension implementing python's set-like interfaces. More... | |
class | basic_string_ |
main string template More... | |
class | vector_ |
a vector extension implementing python's list-like interfaces. More... |
Typedefs | |
typedef basic_string_< char > | str |
the main string type in proton. | |
typedef basic_string_< wchar_t > | wstr |
the main wstring type in proton. |
Functions | |
template<typename T > | |
const detail::min_t< T >::item_t & | min (const T &v) |
smallest item. | |
template<typename T > | |
const detail::max_t< T >::item_t & | max (const T &v) |
largest item. | |
template<typename T , typename V > | |
bool | has (const T &x, V &&v) |
check if x has val. | |
template<typename T > | |
size_t | len (const T &v) |
get length. | |
template<typename T , typename A , typename V > | |
std::deque< T, A > & | operator<< (std::deque< T, A > &x, V &&val) |
add an item in streaming style. | |
template<typename T , typename A , typename V > | |
std::deque< T, A > & | operator>> (std::deque< T, A > &x, V &val) |
pop an item in streaming style. | |
template<typename T , typename A > | |
std::ostream & | operator<< (std::ostream &s, const std::deque< T, A > &x) |
general output for deque. | |
template<typename T , typename A , typename X > | |
deque_< T, A > | operator+ (const std::deque< T, A > &s, X &&t) |
deque + deque | |
template<typename T , typename A > | |
deque_< T, A > | operator* (const std::deque< T, A > &s, size_t n) |
deque_ * n | |
template<typename T , typename A > | |
deque_< T, A > | operator* (size_t n, const std::deque< T, A > &s) |
n * deque_ | |
template<typename T , typename A > | |
deque_< T, A > & | cast_ (std::deque< T, A > &x) |
cast to proton::deque_<>& from std::deque<>&. | |
std::tuple< vector_ < std::tuple< str, str > >, vector_< str > > | getopt (int argc, char *const argv[], const str &optstr, const vector_< str > &longopt={}) |
like getopt in python. | |
template<typename _Key , typename _Tp , typename _Cmp , typename _Alloc > | |
std::map< _Key, _Tp, _Cmp, _Alloc > & | operator<< (std::map< _Key, _Tp, _Cmp, _Alloc > &x, const std::pair< const _Key, _Tp > &item) |
add an item in streaming style. | |
template<typename _Key , typename _Tp , typename _Cmp , typename _Alloc > | |
std::ostream & | operator<< (std::ostream &s, const std::map< _Key, _Tp, _Cmp, _Alloc > &x) |
general output for map. | |
template<typename K , typename T , typename C , typename A > | |
map_< K, T, C, A > & | cast_ (std::map< K, T, C, A > &x) |
cast to proton::map_<>& from std::map<>&. | |
template<typename refT > | |
bool | is_null (const refT &x) |
test a ref null or not. | |
template<typename refT > | |
bool | is_valid (const refT &x) |
test a ref valid or not. | |
template<typename refT > | |
refT | copy (const refT &x) |
Generate a copy of object. | |
template<typename refT > | |
void | reset (refT &x) |
reset a ref to release its object if any. | |
template<typename refT > | |
long | ref_count (const refT &x) |
get the reference count of the object. | |
template<typename T , typename refT > | |
T | cast (const refT &x) |
cast from a ref type to another. | |
template<typename T > | |
std::ostream & | operator<< (typename T::proton_ostream_t &s, const T &y) |
general output for refs. | |
template<typename T , typename C , typename A , typename V > | |
std::set< T, C, A > & | operator<< (std::set< T, C, A > &x, V &&val) |
add an item in streaming style. | |
template<typename T , typename C , typename A , typename V > | |
std::set< T, C, A > & | operator>> (std::set< T, C, A > &x, V &val) |
pop an item in streaming style. | |
template<typename T , typename C , typename A > | |
std::ostream & | operator<< (std::ostream &s, const std::set< T, C, A > &x) |
general output for set. | |
template<typename T , typename C , typename A > | |
std::set< T, C, A > & | operator&= (std::set< T, C, A > &x, const std::set< T, C, A > &y) |
&= | |
template<typename T , typename C , typename A > | |
std::set< T, C, A > & | operator|= (std::set< T, C, A > &x, const std::set< T, C, A > &y) |
|= | |
template<typename T , typename C , typename A > | |
set_< T, C, A > | operator& (const std::set< T, C, A > &x, const std::set< T, C, A > &y) |
set & set | |
template<typename T , typename C , typename A > | |
set_< T, C, A > | operator| (const std::set< T, C, A > &x, const std::set< T, C, A > &y) |
set | set | |
template<typename T , typename C , typename A > | |
set_< T, C, A > & | cast_ (std::set< T, C, A > &x) |
cast to proton::set_<>& from std::set<>&. | |
template<typename string_list , typename string > | |
void | split (string_list &r, const string &s, string spc="", int null_unite=-1) |
split a string. | |
template<typename string_list > | |
string_list::value_type | join (const char *token, const string_list &r) |
join a list of strings to one string. | |
template<typename string , typename T > | |
string | to_ (T &&n, int base=10) |
convert a number/object to a string. | |
template<typename int_t , typename string > | |
bool | get_int (int_t &r, const string &s, int base=10) |
get integer (including int/long/unsigned and so on) from string. | |
template<typename T , typename C , typename A > | |
basic_string_< T, C, A > | operator+ (const T *s, basic_string_< T, C, A > &t) |
const CharT* + str | |
template<typename C , typename V > | |
basic_string_< C, std::char_traits< C > , smart_allocator< C > > | operator% (const C *f, const V &a) |
const CharT* % V | |
template<typename T , typename C , typename A > | |
basic_string_< T, C, A > | operator* (const basic_string_< T, C, A > &s, size_t n) |
string * n | |
template<typename T , typename C , typename A > | |
basic_string_< T, C, A > | operator* (size_t n, const basic_string_< T, C, A > &s) |
n * string | |
template<typename T , typename C , typename A > | |
basic_string_< T, C, A > & | cast_ (std::basic_string< T, C, A > &x) |
cast to proton::basic_string_<>& from std::basic_string<>&. | |
template<long index, typename... T> | |
detail::at_index < detail::get_index(index, sizeof...(T)), T...>::type | at (const std::tuple< T...> &x) |
like x[index] in python | |
template<long begin, long end = std::numeric_limits<long>::max(), typename... T> | |
detail::sub< std::tuple< T...> , detail::fix_index(begin, sizeof...(T)), detail::fix_size(begin, end, sizeof...(T))>::type | sub (const std::tuple< T...> &x) |
get a slice of tuple x[begin:end] in python | |
template<typename... T> | |
std::ostream & | operator<< (std::ostream &s, const std::tuple< T...> &x) |
general output for tuple. | |
template<typename T2 , typename... T1> | |
auto | operator+ (const std::tuple< T1...> &x, T2 &&y)-> decltype(std |
tuple + tuple | |
template<typename... T> | |
auto | _t (T &&...x)-> decltype(std |
eq to make_tuple | |
template<typename... T> | |
auto | _f (T &&...x)-> decltype(std |
eq to forward_as_tuple | |
template<typename T , typename A , typename V > | |
std::vector< T, A > & | operator<< (std::vector< T, A > &x, V &&val) |
add an item in streaming style. | |
template<typename T , typename A , typename V > | |
std::vector< T, A > & | operator>> (std::vector< T, A > &x, V &val) |
pop an item in streaming style. | |
template<typename T , typename A > | |
std::ostream & | operator<< (std::ostream &s, const std::vector< T, A > &x) |
general output for vector. | |
template<typename T , typename A , typename X > | |
vector_< T, A > | operator+ (const std::vector< T, A > &s, X &&t) |
vector + vector | |
template<typename T , typename A > | |
vector_< T, A > | operator* (const std::vector< T, A > &s, size_t n) |
vector_ * n | |
template<typename T , typename A > | |
vector_< T, A > | operator* (size_t n, const std::vector< T, A > &s) |
n * vector_ | |
template<typename T , typename A > | |
vector_< T, A > & | cast_ (std::vector< T, A > &x) |
cast to proton::vector_<>& from std::vector<>&. |
Variables | |
int | debug_level |
The level controls output of PROTON_LOG(). | |
bool | log_console |
true: PROTON_LOG/PROTON_THROW_IF/PROTON_ERR will output to console, false: no console output for these macros. | |
int | wait_on_err |
0: nonstop, 1: stop on PROTON_ERR, 2: stop on PROTON_THROW_IF assert | |
init_alloc | alloc |
explicitly demand to initialize an object. |
The main proton namespace.