示例#1
0
ConstantExpressionNode::ConstantExpressionNode(const std::tstring& theStrValue)
{
	std::size_t numIJ = std::count(theStrValue.begin(), theStrValue.end(), TEXT('i')) + std::count(theStrValue.begin(),theStrValue.end(),TEXT('j'));
	std::tstring formattedString = std::regex_replace(theStrValue, std::tRegexIterator::regex_type(TEXT("[ij]+")), TEXT(""));
	double numericVal = formattedString == TEXT("") ? 1 : _tstof(formattedString.c_str());

	switch(numIJ % 4)
	{
		case 0:
			this->value= std::complex<double>(numericVal,0);
			break;
		case 1:
			this->value= std::complex<double>(0,numericVal);
			break;
		case 2:
			this->value = std::complex<double>(-numericVal,0);
			break;
		default:
			this->value = std::complex<double>(0,-numericVal);
			break;
	}
}
示例#2
0
void MakeFileNameLowerCase(std::tstring& filename)
{
	std::transform(filename.begin(), filename.end(), filename.begin(), tolower);
}
	std::string tosS(std::tstring w){
		std::string s;
		s.assign(w.begin(), w.end());
		return s;
	}
示例#4
0
TextData::TextData(const std::tstring& text, const tt::Vector2& pos, const tt::Vector4& color):Text( text.begin(), text.end() ),Position(pos),Color(color)
{}