*
* Current types are:
* PRETTY_TIME - s, ms, us, ns, etc.
- * PRETTY_BYTES - kb, MB, GB, etc (goes up by 2^10 = 1024 each time)
- * PRETTY_BYTES_METRIC - kb, MB, GB, etc (goes up by 10^3 = 1000 each time)
+ * PRETTY_BYTES_METRIC - kB, MB, GB, etc (goes up by 10^3 = 1000 each time)
+ * PRETTY_BYTES - kB, MB, GB, etc (goes up by 2^10 = 1024 each time)
+ * PRETTY_BYTES_IEC - KiB, MiB, GiB, etc
* PRETTY_UNITS_METRIC - k, M, G, etc (goes up by 10^3 = 1000 each time)
* PRETTY_UNITS_BINARY - k, M, G, etc (goes up by 2^10 = 1024 each time)
+ * PRETTY_UNITS_BINARY_IEC - Ki, Mi, Gi, etc
*
* @author Mark Rabkin <mrabkin@fb.com>
*/
enum PrettyType {
PRETTY_TIME,
- PRETTY_BYTES,
+
PRETTY_BYTES_METRIC,
+ PRETTY_BYTES_BINARY,
+ PRETTY_BYTES = PRETTY_BYTES_BINARY,
+ PRETTY_BYTES_BINARY_IEC,
+ PRETTY_BYTES_IEC = PRETTY_BYTES_BINARY_IEC,
+
PRETTY_UNITS_METRIC,
PRETTY_UNITS_BINARY,
+ PRETTY_UNITS_BINARY_IEC,
PRETTY_NUM_TYPES
};
* The split interface here supports different output types, selected
* at compile time: StringPiece, fbstring, or std::string. If you are
* using a vector to hold the output, it detects the type based on
- * what your vector contains.
+ * what your vector contains. If the output vector is not empty, split
+ * will append to the end of the vector.
*
* You can also use splitTo() to write the output to an arbitrary
* OutputIterator (e.g. std::inserter() on a std::set<>), in which
* case you have to tell the function the type. (Rationale:
* OutputIterators don't have a value_type, so we can't detect the
- * type in split without being told.)
+ * type in splitTo without being told.)
*
* Examples:
*
* folly::splitTo<StringPiece>(":", "asd:bsd:asd:csd",
* std::inserter(s, s.begin()));
*
- * Split also takes a flag (ignoreEmpty) that indicates whether
- * adjacent tokens should be treated as one separator or not. Note
- * that unlikely strtok() the default is to treat them as separators.
+ * Split also takes a flag (ignoreEmpty) that indicates whether adjacent
+ * delimiters should be treated as one single separator (ignoring empty tokens)
+ * or not (generating empty tokens).
*/
template<class Delim, class String, class OutputType>