Stricter formatting for Property tool, attempts to address #109
This commit is contained in:
parent
fcc17ee652
commit
079b51a26c
@ -94,14 +94,16 @@ void PropertyWindow::SetProperty()
|
|||||||
if(value.length() > 2 && value.substr(0, 2) == "0x")
|
if(value.length() > 2 && value.substr(0, 2) == "0x")
|
||||||
{
|
{
|
||||||
//0xC0FFEE
|
//0xC0FFEE
|
||||||
stringstream buffer;
|
std::stringstream buffer;
|
||||||
|
buffer.exceptions(std::stringstream::failbit | std::stringstream::badbit);
|
||||||
buffer << std::hex << value.substr(2);
|
buffer << std::hex << value.substr(2);
|
||||||
buffer >> tempInt;
|
buffer >> tempInt;
|
||||||
}
|
}
|
||||||
else if(value.length() > 1 && value[0] == '#')
|
else if(value.length() > 1 && value[0] == '#')
|
||||||
{
|
{
|
||||||
//#C0FFEE
|
//#C0FFEE
|
||||||
stringstream buffer;
|
std::stringstream buffer;
|
||||||
|
buffer.exceptions(std::stringstream::failbit | std::stringstream::badbit);
|
||||||
buffer << std::hex << value.substr(1);
|
buffer << std::hex << value.substr(1);
|
||||||
buffer >> tempInt;
|
buffer >> tempInt;
|
||||||
}
|
}
|
||||||
@ -119,12 +121,16 @@ void PropertyWindow::SetProperty()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stringstream(value) >> tempInt;
|
std::stringstream buffer(value);
|
||||||
|
buffer.exceptions(std::stringstream::failbit | std::stringstream::badbit);
|
||||||
|
buffer >> tempInt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stringstream(value) >> tempInt;
|
std::stringstream buffer(value);
|
||||||
|
buffer.exceptions(std::stringstream::failbit | std::stringstream::badbit);
|
||||||
|
buffer >> tempInt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -136,20 +142,24 @@ void PropertyWindow::SetProperty()
|
|||||||
if(value.length() > 2 && value.substr(0, 2) == "0x")
|
if(value.length() > 2 && value.substr(0, 2) == "0x")
|
||||||
{
|
{
|
||||||
//0xC0FFEE
|
//0xC0FFEE
|
||||||
stringstream buffer;
|
std::stringstream buffer;
|
||||||
|
buffer.exceptions(std::stringstream::failbit | std::stringstream::badbit);
|
||||||
buffer << std::hex << value.substr(2);
|
buffer << std::hex << value.substr(2);
|
||||||
buffer >> tempUInt;
|
buffer >> tempUInt;
|
||||||
}
|
}
|
||||||
else if(value.length() > 1 && value[0] == '#')
|
else if(value.length() > 1 && value[0] == '#')
|
||||||
{
|
{
|
||||||
//#C0FFEE
|
//#C0FFEE
|
||||||
stringstream buffer;
|
std::stringstream buffer;
|
||||||
|
buffer.exceptions(std::stringstream::failbit | std::stringstream::badbit);
|
||||||
buffer << std::hex << value.substr(1);
|
buffer << std::hex << value.substr(1);
|
||||||
buffer >> tempUInt;
|
buffer >> tempUInt;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stringstream(value) >> tempUInt;
|
std::stringstream buffer(value);
|
||||||
|
buffer.exceptions(std::stringstream::failbit | std::stringstream::badbit);
|
||||||
|
buffer >> tempUInt;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cout << "Got uint value " << tempUInt << std::endl;
|
std::cout << "Got uint value " << tempUInt << std::endl;
|
||||||
@ -157,11 +167,15 @@ void PropertyWindow::SetProperty()
|
|||||||
propValue = &tempUInt;
|
propValue = &tempUInt;
|
||||||
break;
|
break;
|
||||||
case StructProperty::Float:
|
case StructProperty::Float:
|
||||||
istringstream(value) >> tempFloat;
|
{
|
||||||
|
std::stringstream buffer(value);
|
||||||
|
buffer.exceptions(std::stringstream::failbit | std::stringstream::badbit);
|
||||||
|
buffer >> tempFloat;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cout << "Got float value " << tempFloat << std::endl;
|
std::cout << "Got float value " << tempFloat << std::endl;
|
||||||
#endif
|
#endif
|
||||||
propValue = &tempFloat;
|
propValue = &tempFloat;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
new ErrorMessage("Could not set property", "Invalid property");
|
new ErrorMessage("Could not set property", "Invalid property");
|
||||||
|
Loading…
Reference in New Issue
Block a user