mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-10-05 19:41:40 +00:00
Merge branch 'devv'
This commit is contained in:
commit
edda8f17ba
@ -24,9 +24,16 @@ using std::unordered_map;
|
|||||||
using std::make_pair;
|
using std::make_pair;
|
||||||
using std::ostringstream;
|
using std::ostringstream;
|
||||||
|
|
||||||
void read_value(const char * arg, std::string * location)
|
bool read_value(const char * arg, char * location)
|
||||||
|
{
|
||||||
|
*location = arg[0];
|
||||||
|
return (arg[1] == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool read_value(const char * arg, std::string * location)
|
||||||
{
|
{
|
||||||
*location = std::string(arg);
|
*location = std::string(arg);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump_value(std::ostream & out, const std::string & v)
|
void dump_value(std::ostream & out, const std::string & v)
|
||||||
|
@ -22,16 +22,14 @@ namespace pdf2htmlEX {
|
|||||||
|
|
||||||
//helper
|
//helper
|
||||||
template<class T>
|
template<class T>
|
||||||
void read_value(const char * arg, T * location)
|
bool read_value(const char * arg, T * location)
|
||||||
{
|
{
|
||||||
std::istringstream sin(arg);
|
std::istringstream sin(arg);
|
||||||
if((sin >> (*location)) && (sin.eof()))
|
return ((sin >> (*location)) && (sin.eof()));
|
||||||
return;
|
|
||||||
|
|
||||||
throw std::string("Invalid argument: ") + arg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void read_value(const char * arg, std::string * location);
|
extern bool read_value(const char * arg, char * location);
|
||||||
|
extern bool read_value(const char * arg, std::string * location);
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
void dump_value(std::ostream & out, const T & v)
|
void dump_value(std::ostream & out, const T & v)
|
||||||
@ -126,7 +124,8 @@ void ArgParser::ArgEntry<T, Tv>::parse(const char * arg) const
|
|||||||
if(!arg)
|
if(!arg)
|
||||||
throw std::string("Missing argument of option: --") + name;
|
throw std::string("Missing argument of option: --") + name;
|
||||||
|
|
||||||
read_value(arg, location);
|
if(!read_value(arg, location))
|
||||||
|
throw std::string("Invalid argument: ") + arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(callback)
|
if(callback)
|
||||||
|
Loading…
Reference in New Issue
Block a user