Commit 06bd16a9 authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼
Browse files

state: port to C++

parent be1310ec
......@@ -23,6 +23,8 @@
#pragma once
#include <string>
/* Common states for most objects in VILLAScommon (paths, nodes, hooks, plugins) */
enum class State {
DESTROYED = 0,
......@@ -52,4 +54,4 @@ enum class State {
typedef int (*dtor_cb_t)(void *);
/** Convert state enum to human readable string. */
const char * state_print(enum State s);
std::string stateToString(enum State s);
......@@ -25,46 +25,37 @@
#include <cstdlib>
const char * state_print(enum State s)
std::string stateToString(enum State s)
{
switch (s) {
case State::DESTROYED:
return "destroyed";
break;
case State::INITIALIZED:
return "initialized";
break;
case State::PARSED:
return "parsed";
break;
case State::CHECKED:
return "checked";
break;
case State::STARTED:
return "running";
break;
case State::STOPPED:
return "stopped";
break;
case State::PENDING_CONNECT:
return "pending-connect";
break;
case State::CONNECTED:
return "connected";
break;
case State::PAUSED:
return "paused";
break;
default:
return nullptr;
return "";
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment