31 using namespace basis;
33 using namespace cromp;
45 #define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), astring(s))
46 #define BASE_LOG(s) EMERGENCY_LOG(program_wide_logger::get(), astring(s))
57 virtual int execute();
66 cromp_decoder::~cromp_decoder() {}
68 int cromp_decoder::execute()
73 This application will decode a cromp entity and report the different values");
75 that are encoded into it.");
80 BASE_LOG(
"Please enter the entity (or hit just enter to exit).")
83 char *buf2 = fgets(buffer.s(),
MAX_LINE, stdin);
84 if (buf2 != buffer.s()) {
86 "memory was allocated when we didn't want it to be.");
90 buffer.
strip(
"\r\n", astring::FROM_END);
91 if (!buffer.
length())
break;
94 int indy = buffer.
find(
'/');
99 BASE_LOG(
"That entity was blank or invalid.");
114 bool worked = cromp_common::decode_host(ent.
hostname(), host, machine);
116 BASE_LOG(
"Failed to decode the hostname! Was it a valid entity?");
The application_shell is a base object for console programs.
a_sprintf is a specialization of astring that provides printf style support.
Provides a dynamically resizable ASCII character string.
virtual void zap(int start, int end)
Deletes the characters between "start" and "end" inclusively.
void strip(const astring &strip_list, how_to_strip way=FROM_BOTH_SIDES)
strips all chars from "strip_list" out of "this" given the "way".
void shrink()
changes all occurrences of "to_replace" into "new_string".
int end() const
returns the index of the last (non-null) character in the string.
int length() const
Returns the current length of the string.
int find(char to_find, int position=0, bool reverse=false) const
Locates "to_find" in "this".
Provides a way of identifying users of an octopus object.
int process_id() const
returns the process number in the id.
const basis::astring & hostname() const
returns the hostname portion of the id.
int add_in() const
returns the random add-in from the id.
int sequencer() const
returns the sequencing number from the id.
bool blank() const
true if the entity is blank, as constructed by default constructor.
basis::astring text_form() const
#define deadly_error(c, f, i)
#define DEFINE_CLASS_NAME(objname)
Defines the name of a class by providing a couple standard methods.
#define FUNCDEF(func_in)
FUNCDEF sets the name of a function (and plugs it into the callstack).
Provides macros that implement the 'main' program of an application.
#define HOOPLE_MAIN(obj_name, obj_args)
options that should work for most unix and linux apps.
Implements an application lock to ensure only one is running at once.
The guards collection helps in testing preconditions and reporting errors.
bool non_negative(const type &a)
non_negative returns true if "a" is greater than or equal to zero.
A platform independent way to obtain the timestamp of a file.
A logger that sends to the console screen using the standard output device.
An extension to floating point primitives providing approximate equality.
Provides access to the operating system's socket methods.
A dynamic container class that holds any kind of object via pointers.
Useful support functions for unit testing, especially within hoople.