void
UDPKinectSkeleton::_writeStringOSC(const StlString & value,
                                   ArRef<AbstractOStream> stream)
{
unsigned int modulo = 4+4*(value.size()/4)-value.size();
//cout<<"size "<<value.size()<<" Modulo "<<modulo<<endl;
//cout<<"Write string OSC [";
for (unsigned int i(0);i<value.size();++i)
  { 
  stream->writeChar(value[i]);
  //cout<<value[i];
  }
for (unsigned int i(0);i<modulo;++i)
  { 
  //cout<<"0";
  stream->writeChar(0);
  }
//cout<<"]"<<endl;
}
Esempio n. 2
0
static bool IsPartOfMultipartArchive(const StlString& fname)
{
	StlString fname_nopath;
	size_t last_slash_pos = fname.find_last_of(_T('\\'));
	if (fname.size() == last_slash_pos)
	{
		LOG(("[IsPartOfMultipartArchive] ERROR: wrong file name: %S\n", 
			(wstring(fname.begin(), fname.end())).c_str()));
		return false;
	}
	fname_nopath = (StlString::npos == last_slash_pos) ? fname : fname.substr(last_slash_pos + 1);

	boost::tregex re(_T("(.*)(\\.part)([0-9]+)(\\.rar)"), 
		boost::tregex::perl|boost::tregex::icase); 


	bool ret_val = false;

	if (boost::regex_match(fname_nopath, re))
	{
		size_t pos;
		pos = fname_nopath.find_last_of(_T('.'));
		if (StlString::npos != pos)
		{
			StlString tmp = fname_nopath.substr(0, pos);
			pos = tmp.find_last_of(_T(".part"));
			if (StlString::npos != pos && pos < tmp.size() - 1)
			{
				tmp = tmp.substr(pos + 1);
				int part_num = _ttoi(tmp.c_str());
				
				ret_val = (part_num != 1);
			}
		}
	}

	return ret_val;
}