aboutsummaryrefslogtreecommitdiff
path: root/lout/misc.hh
diff options
context:
space:
mode:
Diffstat (limited to 'lout/misc.hh')
-rw-r--r--lout/misc.hh26
1 files changed, 26 insertions, 0 deletions
diff --git a/lout/misc.hh b/lout/misc.hh
index 0a05db31..80f227f8 100644
--- a/lout/misc.hh
+++ b/lout/misc.hh
@@ -38,6 +38,26 @@ inline void assertNotReached ()
abort ();
}
+inline void assertNotReached (const char *fmt, ...)
+{
+ va_list argp;
+ va_start(argp, fmt);
+
+ fprintf (stderr, "*** [%s] This should not happen: ", prgName);
+ vfprintf(stderr, fmt, argp);
+ fprintf (stderr, "! ***\n");
+
+ va_end(argp);
+
+ abort ();
+}
+
+inline void notImplemented (const char *name)
+{
+ fprintf (stderr, "*** [%s] Not implemented: %s ***\n", prgName, name);
+ abort ();
+}
+
inline int roundInt(double d)
{
return (int) ((d > 0) ? (d + 0.5) : (d - 0.5));
@@ -64,6 +84,8 @@ inline int AsciiStrcasecmp(const char *s1, const char *s2)
return ret;
}
+inline const char *boolToStr (bool b) { return b ? "true" : "false"; }
+
/**
* \brief Simple (simpler than container::untyped::Vector and
* container::typed::Vector) template based vector.
@@ -118,6 +140,8 @@ public:
*/
inline int size() const { return this->num; }
+ inline bool empty() const { return size() == 0; }
+
inline T* getArray() const { return array; }
inline T* detachArray() {
@@ -378,6 +402,8 @@ public:
inline int size() const { return this->numMain + this->numExtra; }
+ inline bool empty() const { return size() == 0; }
+
inline void increase() { setSize(size() + 1); }
inline void setSize(int newSize)