2015-05-03 18:44:02 +00:00
|
|
|
/*
|
|
|
|
* ace_parse_imagepath.cpp
|
|
|
|
* Author: PabstMirror
|
|
|
|
* Gets raw image path from structured text input.
|
|
|
|
*
|
|
|
|
* Takes:
|
|
|
|
* Structured text that usualy has an image:
|
|
|
|
* Example: "<img image='\A3\Ui_f\data\IGUI\Cfg\Actions\open_door_ca.paa' size='2.5' />";
|
|
|
|
*
|
|
|
|
* Returns:
|
|
|
|
* Just the image path or "" if none
|
|
|
|
*/
|
|
|
|
|
2015-05-17 09:05:43 +00:00
|
|
|
#include "shared.hpp"
|
2015-05-03 18:44:02 +00:00
|
|
|
|
2016-02-17 22:19:23 +00:00
|
|
|
#include <stdlib.h>
|
2015-05-03 18:44:02 +00:00
|
|
|
#include <sstream>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
extern "C" {
|
2016-01-29 11:21:46 +00:00
|
|
|
EXPORT void __stdcall RVExtension(char *output, int outputSize, const char *function);
|
2015-09-08 19:53:29 +00:00
|
|
|
}
|
2015-05-03 18:44:02 +00:00
|
|
|
|
|
|
|
std::string getImagePathFromStructuredText(const std::string & input) {
|
|
|
|
std::string returnValue = "";
|
|
|
|
std::size_t endIndex = input.find(".paa");
|
|
|
|
std::size_t startIndex = endIndex - 1;
|
|
|
|
if ((endIndex != std::string::npos) && (endIndex > 1)) {
|
|
|
|
endIndex = endIndex + 4;
|
|
|
|
while ((startIndex > 0) && (returnValue == "")) {
|
|
|
|
if ((input[startIndex]) == '\'') {
|
|
|
|
returnValue = input.substr((startIndex + 1), (endIndex - startIndex - 1));
|
|
|
|
};
|
|
|
|
startIndex = startIndex - 1;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
return returnValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
2016-02-17 22:19:23 +00:00
|
|
|
ZERO_OUTPUT();
|
2015-05-03 18:44:02 +00:00
|
|
|
if (!strcmp(function, "version")) {
|
2019-09-28 21:03:55 +00:00
|
|
|
strncpy(output, ACE_FULL_VERSION_STR, outputSize);
|
2015-05-03 18:44:02 +00:00
|
|
|
} else {
|
2019-09-28 21:03:55 +00:00
|
|
|
strncpy(output, getImagePathFromStructuredText(function).c_str(), outputSize);
|
2015-05-03 18:44:02 +00:00
|
|
|
}
|
2016-02-17 22:19:23 +00:00
|
|
|
EXTENSION_RETURN();
|
2015-05-03 18:44:02 +00:00
|
|
|
}
|