Example #1
0
bool cMotion::Load(const std::string& file)
{
	Clear();
	
	std::ifstream f_stream(file);
	Json::Value root;
	Json::Reader reader;
	bool succ = reader.parse(f_stream, root);
	f_stream.close();

	if (succ)
	{
		succ = LoadJson(root);
		if (succ)
		{
			PostProcessFrames(mFrames);
		}
		else
		{
			printf("Failed to load motion from file %s\n", file.c_str());
			assert(false);
		}
	}
	else
	{
		printf("Failed to parse Json from %s\n", file.c_str());
		assert(false);
	}
	return succ;
}
Example #2
0
void cController::ReadParams(const std::string& file)
{
	if (file != "")
	{
		std::ifstream f_stream(file);
		if (f_stream.is_open())
		{
			ReadParams(f_stream);
		}
		f_stream.close();
	}
}
Example #3
0
		void SourceFile::read_file(const wchar_t* filename)
		{
			std::wifstream f_stream(filename, std::ifstream::in);

			if (!f_stream.good())
				throw ElsaException("Could not open file");

			f_stream.imbue(std::locale(std::locale::empty(), new std::codecvt_utf8<wchar_t>));

			stream_ << f_stream.rdbuf();

			// If the file has a utf-8 byte order mark just skip it
			if (stream_.peek() == 65279)
				stream_.get();
		}