Utility Class Reference

`#include <utility.h>`

Collaboration diagram for Utility:

## Static Public Member Functions

static char * | strtolower (char *)
static std::string & | strtolower (std::string &)
static std::string | strtolower (const std::string &)
static std::string | strtoupper (const std::string &)
static bool | isTrueFalse (const char *)
static bool | isTrueFalse (const std::string &)
static bool | isTrue (const char *)
static bool | isTrue (const std::string &)
static bool | isFalse (const char *)
static bool | isFalse (const std::string &)
static bool | isYesNo (const char *)
static bool | isYesNo (const std::string &)
static bool | isYes (const char *)
static bool | isYes (const std::string &)
static bool | isNo (const char *)
static bool | isNo (const std::string &)
static double | toDouble (const std::string)
static int | toInt (const std::string)
static std::string | dirname (const std::string &)
static std::string | filename (const std::string &)
static bool | is_directory_usable (const std::string &dir)
static void | create_directory (const std::string &dir)

## Detailed Description

Definition at line 33 of file utility.h.

## Member Function Documentation

## create_directory()

void Utility::create_directory | ( | const std::string & | dir | ) |

static

Create directory

Definition at line 329 of file utility.cpp.

Referenced by DatabaseConnector::set_database_filename().

Here is the caller graph for this function:

## dirname()

std::string Utility::dirname | ( | const std::string & | filepath | ) |

static

Return directory name from filepath

Definition at line 274 of file utility.cpp.

Referenced by DatabaseConnector::set_database_filename().

Here is the caller graph for this function:

## filename()

std::string Utility::filename | ( | const std::string & | filepath | ) |

static

Return file name from filepath

Definition at line 290 of file utility.cpp.

## is_directory_usable()

bool Utility::is_directory_usable | ( | const std::string & | dir | ) |

static

Attempt to open directory and return true if successful

Definition at line 306 of file utility.cpp.

Referenced by DatabaseConnector::set_database_filename().

Here is the caller graph for this function:

## isFalse() [1/2]

bool Utility::isFalse | ( | const char * | str | ) |

static

Is string False

Definition at line 127 of file utility.cpp.

## isFalse() [2/2]

bool Utility::isFalse | ( | const std::string & | str | ) |

static

Is string False

Definition at line 157 of file utility.cpp.

## isNo() [1/2]

bool Utility::isNo | ( | const char * | str | ) |

static

Is string No

Definition at line 207 of file utility.cpp.

## isNo() [2/2]

bool Utility::isNo | ( | const std::string & | str | ) |

static

Is string No

Definition at line 249 of file utility.cpp.

## isTrue() [1/2]

bool Utility::isTrue | ( | const char * | str | ) |

static

Is string True

Definition at line 106 of file utility.cpp.

Referenced by ProfileManager::set_autopersist().

Here is the caller graph for this function:

## isTrue() [2/2]

bool Utility::isTrue | ( | const std::string & | str | ) |

static

Is string True

Definition at line 148 of file utility.cpp.

## isTrueFalse() [1/2]

bool Utility::isTrueFalse | ( | const char * | str | ) |

static

Is string either true or false

Definition at line 96 of file utility.cpp.

## isTrueFalse() [2/2]

bool Utility::isTrueFalse | ( | const std::string & | str | ) |

static

Is string either true or false

Definition at line 166 of file utility.cpp.

## isYes() [1/2]

bool Utility::isYes | ( | const char * | str | ) |

static

Is string Yes

Definition at line 184 of file utility.cpp.

Referenced by SmoothedNgramPredictor::set_learn(), ContextTracker::set_lowercase_mode(), ContextTracker::set_online_learning(), and Selector::set_repeat_suggestions().

Here is the caller graph for this function:

## isYes() [2/2]

bool Utility::isYes | ( | const std::string & | str | ) |

static

Is string Yes

Definition at line 240 of file utility.cpp.

## isYesNo() [1/2]

bool Utility::isYesNo | ( | const char * | str | ) |

static

Is string either yes or no

Definition at line 175 of file utility.cpp.

## isYesNo() [2/2]

bool Utility::isYesNo | ( | const std::string & | str | ) |

static

Is string either yes or no

Definition at line 231 of file utility.cpp.

## strtolower() [1/3]

char * Utility::strtolower | ( | char * | str | ) |

static

Convert string to lower case

Definition at line 41 of file utility.cpp.

Referenced by ContextTracker::isCompletionValid(), ARPAPredictor::predict(), and PredictorActivator::setCombinationPolicy().

Here is the caller graph for this function:

## strtolower() [2/3]

std::string Utility::strtolower | ( | const std::string & | str | ) |

static

Returns a lower case copy of a string

Definition at line 66 of file utility.cpp.

## strtolower() [3/3]

std::string & Utility::strtolower | ( | std::string & | str | ) |

static

Convert string to lower case

Definition at line 53 of file utility.cpp.

## strtoupper()

std::string Utility::strtoupper | ( | const std::string & | str | ) |

static

Convert string to upper case

Definition at line 81 of file utility.cpp.

## toDouble()

double Utility::toDouble | ( | const std::string | str | ) |

static

Convert string to double.

Definition at line 257 of file utility.cpp.

Referenced by SmoothedNgramPredictor::set_deltas(), RecencyPredictor::set_lambda(), RecencyPredictor::set_n_0(), and DictionaryPredictor::set_probability().

Here is the caller graph for this function:

## toInt()

int Utility::toInt | ( | const std::string | str | ) |

static

Convert string to int.

Definition at line 265 of file utility.cpp.

Referenced by RecencyPredictor::set_cutoff_threshold(), Selector::set_greedy_suggestion_threshold(), Selector::set_suggestions(), DejavuPredictor::set_trigger(), PredictorActivator::setMaxPartialPredictionSize(), and PredictorActivator::setPredictTime().

Here is the caller graph for this function:

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

- /build/presage-hvZ4Ld/presage-0.9.1/src/lib/core/utility.h
- /build/presage-hvZ4Ld/presage-0.9.1/src/lib/core/utility.cpp