Exemplo n.º 1
0
/**
 * Return the frequency as specified in the config file.
 */
int unsigned FtdiDmxPlugin::GetFrequency() {
  unsigned int frequency;

  if (!StringToInt(m_preferences->GetValue(K_FREQUENCY), &frequency))
    StringToInt(DEFAULT_FREQUENCY, &frequency);
  return frequency;
}
Exemplo n.º 2
0
void ParseFace(const std::string& line, std::vector<Face>& faces)
{
	Face face;

	// First split by spaces
	std::vector<std::string> tripletTokens = Tokenize(line, " \t");

	// Skip first and process triplets
	for (auto it = tripletTokens.cbegin() + 1; it != tripletTokens.cend(); ++it)
	{
		const auto token = *it;

		IndexTriplet triplet;

		// Split by slashes to indices
		std::vector<std::string> intTokens = Tokenize(token, "/");

		if (intTokens.size() == 3) // "pos/tex/nor"
		{
			triplet.positionIndex = StringToInt(intTokens[0]);
			triplet.texcoordIndex = StringToInt(intTokens[1]);
			triplet.normalIndex = StringToInt(intTokens[2]);
		}
		if (intTokens.size() == 2) // "pos//nor"
		{
			triplet.positionIndex = StringToInt(intTokens[0]);
			triplet.normalIndex = StringToInt(intTokens[1]);
		}

		face.indices.push_back(triplet);
	}
	faces.push_back(face);
}
Exemplo n.º 3
0
MyML GameEngine::Draw()
{
    MyML myml("T1;T2");


    myml.E("T1").AddArray("Player");


    for(int i=0;i<StringToInt(data.A("Team1.Player.size"));i++){
        MyML& p=data.E("Team1.Player").E(IntToString(i));
        MyML player("id=@0|id;color=@0|color;Pos=@0|Pos",{p});


        player.Do("Gui.OldPos=@0|Gui.OldPos",{p} );
        myml.E("T1.Player").Type<MyMLArray>().Add(player);
    }
    for(int i=0;i<StringToInt(data.A("Team2.Player.size"));i++){
        MyML& p=data.E("Team2.Player").E(IntToString(i));
        MyML player("id=@0|id;color=@0|color;Pos=@0|Pos",{p});


        player.Do("Pos.x=null;Pos.y=null;");
        player.E("Pos",invert(data.E("Team2.Player").E(STR(i)).E("Pos")));
        player.E("Gui.OldPos",invert(data.E("Team2.Player").E(STR(i)).E("Gui.OldPos")));
        myml.E("T1.Player").Type<MyMLArray>().Add(player);
    }


    myml.CpE(data,"Ball");


    //cout<<myml.E("T1").E("Player").attributes["posy"]<<endl;
    return myml;
}
Exemplo n.º 4
0
void SPIDevice::PopulateSoftwareBackendOptions(
    SoftwareBackend::Options *options) {
  StringToInt(m_preferences->GetValue(PortCountKey()), &options->outputs);
  StringToInt(m_preferences->GetValue(SyncPortKey()), &options->sync_output);
  if (options->sync_output == -2) {
    options->sync_output = options->outputs - 1;
  }
}
Exemplo n.º 5
0
const net_call_out_rec* Callout::net_call_out_for(const std::string& node) const {
  VLOG(2) << "Callout::net_call_out_for(" << node << ")";
  if (starts_with(node, "20000:20000/")) {
    auto s = node.substr(12);
    s = s.substr(0, s.find('/'));
    return net_call_out_for(StringToInt(s));
  }
  return net_call_out_for(StringToInt(node));
}
Exemplo n.º 6
0
static err_t Open(urlpart* p, const tchar_t* URL, int Flags)
{
    err_t Result;
    const tchar_t *String, *Equal;
    tchar_t Value[MAXPATHFULL];
    datetime_t Date = INVALID_DATETIME_T;

    String = tcsrchr(URL,URLPART_SEP_CHAR);
    if (!String)
        return ERR_INVALID_DATA;
    
    Clear(p);
    Node_SetData((node*)p,STREAM_URL,TYPE_STRING,URL);

    Equal = GetProtocol(URL,NULL,0,NULL);
    tcsncpy_s(Value,TSIZEOF(Value),Equal,String-Equal);
    tcsreplace(Value,TSIZEOF(Value),URLPART_SEP_ESCAPE,URLPART_SEPARATOR);
    Node_SetData((node*)p,URLPART_URL,TYPE_STRING,Value);
    while (String++ && *String)
    {
        Equal = tcschr(String,T('='));
        if (Equal)
        {
            tchar_t *Sep = tcschr(Equal,T('#'));
            if (Sep)
                tcsncpy_s(Value,TSIZEOF(Value),Equal+1,Sep-Equal-1);
            else
                tcscpy_s(Value,TSIZEOF(Value),Equal+1);

            if (tcsncmp(String,T("ofs"),Equal-String)==0)
                p->Pos = StringToInt(Value,0);
            else if (tcsncmp(String,T("len"),Equal-String)==0)
                p->Length = StringToInt(Value,0);
            else if (tcsncmp(String,T("mime"),Equal-String)==0)
                Node_SetData((node*)p,URLPART_MIME,TYPE_STRING,Value);
            else if (tcsncmp(String,T("date"),Equal-String)==0)
                Date = StringToInt(Value,0);
        }
        String = tcschr(String,'#');
    }

    if (Date!=INVALID_DATETIME_T && Date != FileDateTime(Node_Context(p),Node_GetDataStr((node*)p,URLPART_URL)))
        return ERR_INVALID_DATA;

    p->Input = GetStream(p,Node_GetDataStr((node*)p,URLPART_URL),Flags);
    if (!p->Input)
        return ERR_NOT_SUPPORTED;
    Stream_Blocking(p->Input,p->Blocking);
    Result = Stream_Open(p->Input,Node_GetDataStr((node*)p,URLPART_URL),Flags);
    if (Result == ERR_NONE && p->Pos!=INVALID_FILEPOS_T) // TODO: support asynchronous stream opening
    {
        if (Stream_Seek(p->Input,p->Pos,SEEK_SET)!=p->Pos)
            return ERR_INVALID_DATA;
    }
    return Result;
}
Exemplo n.º 7
0
int ParseTokens(const char* left, const char* right)
{
    int left_int = StringToInt(left);
    char* tmp = strchr(right, '|');
    if(tmp == NULL)
        return (left_int | StringToInt(right));
    tmp[0] = '\0';
    tmp++;
    return (left_int | ParseTokens(right, tmp));
}
Exemplo n.º 8
0
int ParserAttribInt(parser* p)
{
	tchar_t Token[MAXTOKEN];
	if (!ParserAttribString(p,Token,MAXTOKEN))
		return 0;
	if (Token[0]=='0' && Token[1]=='x')
		return StringToInt(Token+2,1);
	else
		return StringToInt(Token,0);
}
Exemplo n.º 9
0
void proccess_rx(void){
	uint32_t u, i;
	
	switch(rx_buffer[0]){
		case 'g':
			u = Actual_U;
			i = Actual_I;
			USART_SendString(USART6, "U:");
			USART_SendNumber(USART6, u);
			USART_SendString(USART6, ", I:");
			USART_SendNumber(USART6, i);
			USART_SendString(USART6, "\n");
			break;
		case 's':
			if(rx_pointer>1){
				u = StringToInt(rx_buffer+1, 5);
				i = StringToInt(rx_buffer+6, 5);
				Set_U = u;
				Set_I = i;
				USART_SendString(USART6, "OK\n");
			}else{
				u = Set_U;
				i = Set_I;
				USART_SendString(USART6, "Set U:");
				USART_SendNumber(USART6, u);
				USART_SendString(USART6, ", Set I:");
				USART_SendNumber(USART6, i);
				USART_SendString(USART6, "\n");
			}
			break;
		case 'o':
			if(rx_pointer>1){
				output = (rx_buffer[1]=='1');
			}		
			USART_SendString(USART6, output?"Output ON\n":"Output OFF\n");
			break;
		case 'q':
			GPIO_SetBits(GPIOC, GPIO_Pin_0);
			USART_SendString(USART6, "PC0 ON\n");
			break;
		case 'a':
			GPIO_ResetBits(GPIOC, GPIO_Pin_0);
			USART_SendString(USART6, "PC0 OFF\n");
			break;
		default:
			USART_SendString(USART6, "Unknown command\n");
			break;
	}
}
Exemplo n.º 10
0
void convert_sl::Get_Date_Int(string date, int &year, int &month, int &day)
{
    year	= StringToInt(date.substr(0,4));
    month	= StringToInt(date.substr(4,2));
    day		= StringToInt(date.substr(6,2));
    // divide date string to year, month, and day string
    //string y(date.c_str(),0,4);
    //string m(date.c_str(),4,2);
    //string d(date.c_str(),6,2);

    //// convert to integer
    //sscanf(y.c_str(),"%d",&year);
    //sscanf(m.c_str(),"%d",&month);
    //sscanf(d.c_str(),"%d",&day);
}
Exemplo n.º 11
0
Announce::Announce(string _areamask, string _msgbase, string _msg_from, 
           string _aka, string _msg_to, string _msg_subject, 
           string _templ, string _origin) : areamask(), msgbase(), msg_from(_msg_from), 
           aka(_aka), msg_to(_msg_to), msg_subject(_msg_subject), templ(_templ), 
           origin(_origin), local(false) { 
  vector<string> v;
  SplitLine(_areamask, (*this).areamask, ',');
  SplitLine(_msgbase, v, ':');
  (*this).msgbase.first = StringToInt(v[0]);
  (*this).msgbase.second = StringToInt(v[1]);
    
  if((*this).aka.isEmpty()) {
    (*this).local = true;
  }
}
void SMLoader::LoadFromTokens( 
			     RString sStepsType, 
			     RString sDescription,
			     RString sDifficulty,
			     RString sMeter,
			     RString sRadarValues,
			     RString sNoteData,
			     Steps &out
			     )
{
	// we're loading from disk, so this is by definition already saved:
	out.SetSavedToDisk( true );

	Trim( sStepsType );
	Trim( sDescription );
	Trim( sDifficulty );
	Trim( sNoteData );

	//	LOG->Trace( "Steps::LoadFromTokens()" );

	// backwards compatibility hacks:
	// HACK: We eliminated "ez2-single-hard", but we should still handle it.
	if( sStepsType == "ez2-single-hard" )
		sStepsType = "ez2-single";

	// HACK: "para-single" used to be called just "para"
	if( sStepsType == "para" )
		sStepsType = "para-single";

	out.m_StepsType = GAMEMAN->StringToStepsType( sStepsType );
	out.SetDescription( sDescription );
	out.SetCredit( sDescription ); // this is often used for both.
	out.SetChartName(sDescription); // yeah, one more for good measure.
	out.SetDifficulty( OldStyleStringToDifficulty(sDifficulty) );

	// Handle hacks that originated back when StepMania didn't have
	// Difficulty_Challenge. (At least v1.64, possibly v3.0 final...)
	if( out.GetDifficulty() == Difficulty_Hard )
	{
		// HACK: SMANIAC used to be Difficulty_Hard with a special description.
		if( sDescription.CompareNoCase("smaniac") == 0 ) 
			out.SetDifficulty( Difficulty_Challenge );

		// HACK: CHALLENGE used to be Difficulty_Hard with a special description.
		if( sDescription.CompareNoCase("challenge") == 0 ) 
			out.SetDifficulty( Difficulty_Challenge );
	}

	if( sMeter.empty() )
	{
		// some simfiles (e.g. X-SPECIALs from Zenius-I-Vanisher) don't
		// have a meter on certain steps. Make the meter 1 in these instances.
		sMeter = "1";
	}
	out.SetMeter( StringToInt(sMeter) );

	out.SetSMNoteData( sNoteData );

	out.TidyUpData();
}
Exemplo n.º 13
0
TError TContainerHolder::RestoreId(const kv::TNode &node, int &id) {
    std::string value = "";

    TError error = Storage->Get(node, P_RAW_ID, value);
    if (error) {
        // FIXME before v1.0 we didn't store id for meta or stopped containers;
        // don't try to recover, just assign new safe one
        error = IdMap.Get(id);
        if (error)
            return error;
        L_WRN() << "Couldn't restore container id, using " << id << std::endl;
    } else {
        error = StringToInt(value, id);
        if (error)
            return error;

        error = IdMap.GetAt(id);
        if (error) {
            // FIXME before v1.0 there was a possibility for two containers
            // to use the same id, allocate new one upon restore we see this

            error = IdMap.Get(id);
            if (error)
                return error;
            L_WRN() << "Container ids clashed, using new " << id << std::endl;
        }
        return error;
    }

    return TError::Success();
}
void isColorPickerDlg::OnEnterComponentText(wxSlider * slider, wxTextCtrl * text)
{
	int ret = StringToInt(text->GetValue());
	if (ret>255 ) ret = 255; if (ret < 0) ret = 0;
	slider->SetValue(ret);
	RefreshColor();
}
Exemplo n.º 15
0
int main(int argc, char* argv[])
{
    int upperBound = DEFAULT_UPPER_BOUND;
    int userUpperBound = 0; //user can set by first command line parameter

    if (argc > 1)
    {
        bool errors;
        userUpperBound = StringToInt(argv[1], errors);
        
        if (errors)
        {
            printf("Invalid argument!");
            return 1;
        }

        if (userUpperBound > LOWER_BOUND)
        {
            upperBound = userUpperBound;
        }
    }

    PrintSpecialNumbers(upperBound);
    return 0;
}
//----------------------------------------------------------------------------------------
bool GenericAccessDataValueInt::SetValueString(const MarshalSupport::Marshal::In<std::wstring>& value)
{
	//Calculate the default base to use for the specified number based on the specified
	//display mode
	unsigned int defaultBase = 10;
	switch(displayMode)
	{
	case IntDisplayMode::Binary:
		defaultBase = 2;
		break;
	case IntDisplayMode::Octal:
		defaultBase = 8;
		break;
	case IntDisplayMode::Decimal:
		defaultBase = 10;
		break;
	case IntDisplayMode::Hexadecimal:
		defaultBase = 16;
		break;
	}

	//Attempt to convert the string to an integer
	int valueConverted;
	if(!StringToInt(value, valueConverted, defaultBase))
	{
		return false;
	}

	//Attempt to set this value to the specified integer
	return SetValueInt(valueConverted);
}
Exemplo n.º 17
0
void ParseHeaderSetResponse(gfcrequest_t *gfr, char *headerBuffer)
{
	char *delimiter = " ";
	char *saveptr;

    char chopHeaderBuffer[strlen(headerBuffer)];
    strcpy(chopHeaderBuffer, headerBuffer);

	printf("Parsing header response string [%s]\n", chopHeaderBuffer);

	// Strips off scheme
	strtok_r(chopHeaderBuffer, delimiter, &saveptr);

	gfr->Response.Status = ParseStatus(strtok_r(NULL, delimiter, &saveptr));
	gfr->Status = gfr->Response.Status;
	if(gfr->Response.Status == GF_OK)
	{
        gfr->Response.Length = StringToInt(strtok_r(NULL, delimiter, &saveptr));
	}
	else
	{
        gfr->Response.Length = 0;
	}

    printf("Response.Status: %d\n", gfr->Response.Status);
    printf("Response.Length: %ld\n", gfr->Response.Length);
}
Exemplo n.º 18
0
TError TClient::LoadGroups() {
    TFile f("/proc/" + std::to_string(Pid) + "/status");

    std::vector<std::string> lines;
    TError error = f.AsLines(lines);
    if (error)
        return error;

    Cred.Groups.clear();
    for (auto &l : lines)
        if (l.compare(0, 8, "Groups:\t") == 0) {
            std::vector<std::string> groupsStr;

            error = SplitString(l.substr(8), ' ', groupsStr);
            if (error)
                return error;

            for (auto g : groupsStr) {
                int group;
                error = StringToInt(g, group);
                if (error)
                    return error;

                Cred.Groups.push_back(group);
            }

            break;
        }

    return TError::Success();
}
Exemplo n.º 19
0
int main(int argc, char* argv[])
{
	setlocale(LC_ALL, "Russian");
	int upLimit = 1000;
	int i;
	int sumDig = 0;
	if (argc > 1)
	{
		bool err;
		upLimit = StringToInt(argv[1], err);
		if ((err) || (upLimit <= 1))
		{
			printf("¬едены не корректыные параметры\n");
			return 1;
		}
	}
	for (i = 1; i <= upLimit; i++)
	{
		sumDig = SumDigits(i);
		if (sumDig == 0)
		{
			continue;
		}
		if (i%sumDig == 0)
		{
			printf("%d ", i);
		}
	}
	printf("\n");
	system("PAUSE");
	return 0;
}
Exemplo n.º 20
0
void BigInt::ReadFromFile(const char* fileName)
{
    ifstream ifst(fileName);
    string str;
    getline(ifst, str);
    StringToInt(str);
}
Exemplo n.º 21
0
int main(void) {

    
    int n = StringToInt("12345678");
    std::cout <<  n << std::endl;
    return 0;
}
Exemplo n.º 22
0
void demo_CacheAlloc()
{
    // leave 1024 bytes for cache allocation
    g_hunk_low_used = g_hunk_total_size - g_hunk_high_used - 1024;

    char cmdLine[32];
    char arg0[16];
    char arg1[16];
    char userCountStr[16];
    CacheUser cacheUser[128] = {0};
    I32 cacheUserCount = 0;

    printf("Cache Alloc Demo Starts ... \n\n");
    printf("Available cache size: %d bytes\n", demo_EndFreeSizeForCache());
    printf("Allocation size includes the size of cache header which is 64 bytes and will be 16-byte aligned\n");
    printf("[allocation count | hole | end: memory size]\n");
    printf("hole and end are free memory blocks\n");
    printf("LRU list: most recent used -> least recent used\n");
    printf("type \"alloc\" and a number to allocate cache or \"exit\" to end the demo\n\n");

    bool running = true;
    while (running)
    {
        if (fgets(cmdLine, 32, stdin) != cmdLine)
        {
            continue ;
        }

        demo_ParseCommand(cmdLine, arg0, arg1);

        if (StringCompare(arg0, "alloc") == 0)
        {
            cacheUserCount++;

            if (cacheUserCount >= 128)
            {
                printf("Exceed maximum times of allocation!");
                break ;
            }

            I32 size = StringToInt(arg1);
            IntToString(cacheUserCount, userCountStr, 16);

            CacheAlloc(cacheUser + cacheUserCount, size, userCountStr);

            demo_drawCacheList();
            demo_DrawLRUList();
        }
        else if (StringCompare(arg0, "exit") == 0)
        {
            running = false;
        }
        else
        {
            printf("unrecognized command\n");
        }
    }

    printf("Cache Alloc Demo Ended.");
}
Exemplo n.º 23
0
/**
 *	Returns the RP Filter Value for an interface
 *	Return on success: RP Filter Value
 *	Return on failure:
 *	-1 : Could not open the Rp Filter Option
 */
int routingHandler::getRpFilterValue(std::string device){

	std::string configName("net.ipv4.conf.");
	configName.append(device);
	configName.append(".rp_filter");

	std::string saveRpFilter("sysctl ");
	saveRpFilter.append(configName);


	FILE* pipe = popen(saveRpFilter.c_str(), "r");
	if(pipe == NULL){
		return -1;
	}
	int bufSize = 512;
	char buffer[bufSize];
	std::string valueString;
	while(!feof(pipe)){
		if(fgets(buffer, bufSize, pipe) != NULL)
			valueString.append(buffer);
	}

	int value = StringToInt(valueString.substr(configName.length()+3));

	pclose(pipe);
	return value;
}
bool FileTransfer::ParseHTTPAddress( const RString &URL, RString &sProto, RString &sServer, int &iPort, RString &sAddress )
{
	// [PROTO://]SERVER[:PORT][/URL]

	Regex re(
		"^([A-Z]+)://" // [0]: HTTP://
		"([^/:]+)"     // [1]: a.b.com
		"(:([0-9]+))?" // [2], [3]: :1234 (optional, default 80)
		"(/(.*))?$");    // [4], [5]: /foo.html (optional)
	vector<RString> asMatches;
	if( !re.Compare( URL, asMatches ) )
		return false;
	ASSERT( asMatches.size() == 6 );

	sProto = asMatches[0];
	sServer = asMatches[1];
	if( asMatches[3] != "" )
	{
		iPort = StringToInt(asMatches[3]);
		if( iPort == 0 )
			return false;
	}
	else
		iPort = 80;

	sAddress = asMatches[5];

	return true;
}
Exemplo n.º 25
0
/**
 * @brief Caches level data from file into arrays.
 **/
void LevelSystemOnCacheData(/*void*/)
{
    // Gets config file path
    static char sPathLevels[PLATFORM_LINE_LENGTH];
    ConfigGetConfigPath(File_Levels, sPathLevels, sizeof(sPathLevels));
    
    // Validate levels config
    int iLevels = gServerData.Levels.Length;
    if(!iLevels)
    {
        LogEvent(false, LogType_Fatal, LOG_GAME_EVENTS, LogModule_Levels, "Config Validation", "No usable data found in levels config file: %s", sPathLevels);
        return;
    }
    
    // Initialize a level list array
    ArrayList hLevel = CreateArray();

    // i = level array index
    for(int i = 0; i < iLevels; i++)
    {
        // Gets level index
        gServerData.Levels.GetString(i, sPathLevels, sizeof(sPathLevels));

        // Validate unique integer
        int iLimit = StringToInt(sPathLevels);
        if(iLimit <= 0 || hLevel.FindValue(iLimit) != -1)
        {
            // Log level error info
            LogEvent(false, LogType_Error, LOG_GAME_EVENTS, LogModule_Levels, "Config Validation", "Incorrect level \"%s\"", sPathLevels);
            
            // Remove level from array
            gServerData.Levels.Erase(i);

            // Subtract one from count
            iLevels--;

            // Backtrack one index, because we deleted it out from under the loop
            i--;
            continue;
        }
        
        // Push data into array
        hLevel.Push(iLimit);
    }
    
    // Validate levels config (after converation)
    if(!iLevels)
    {
        LogEvent(false, LogType_Fatal, LOG_GAME_EVENTS, LogModule_Levels, "Config Validation", "No usable data found in levels config file: %s", sPathLevels);
        return;
    }
    
    /// Do quick sort!
    SortADTArray(hLevel, Sort_Ascending, Sort_Integer);
    
    // Replace with new array
    delete gServerData.Levels;
    gServerData.Levels = hLevel.Clone();
    delete hLevel;
}
Exemplo n.º 26
0
BOOL ParseEscapeCode(Format* f)
{
    INT AnsiColor[8] = {BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE};
    LPTSTR s;
    INT i;

    EscBuf[EscBufPos] = 0;
    if (EscBuf[0] != TEXT('['))
        return FALSE;

    s = &EscBuf[1];
    for (i = 1; i <= EscBufPos; i++) {
        if (EscBuf[i] == TEXT(';'))
            EscBuf[i] = 0;

        if (EscBuf[i] == 0) {
            INT Val = StringToInt(s);
            s = &EscBuf[i+1];

            if (Val == 0)
                *f = DefFormat;
            else if (Val == 1)
                f->Bold = TRUE;
            else if (Val == 4)
                f->Underline = TRUE;
            else if (Val >= 30 && Val <= 37)
                f->ForeColor = AnsiColor[Val - 30];
            else if (Val >= 40 && Val <= 47)
                f->BackColor = AnsiColor[Val - 40];
        }
    }
    return TRUE;
}
Exemplo n.º 27
0
void Parser::SearchForIsolatedNumbers() {
  for (token_container_t::iterator token = tokens_.begin(); token != tokens_.end(); ++token) {
    if (token->category != kUnknown ||
        !IsNumericString(token->content) ||
        !IsTokenIsolated(token))
      continue;

    int number = StringToInt(token->content);

    // Anime year
    if (number >= kAnimeYearMin && number <= kAnimeYearMax) {
      if (elements_.empty(kElementAnimeYear)) {
        elements_.insert(kElementAnimeYear, token->content);
        token->category = kIdentifier;
        continue;
      }
    }

    // Video resolution
    if (number == 480 || number == 720 || number == 1080) {
      // If these numbers are isolated, it's more likely for them to be the
      // video resolution rather than the episode number. Some fansub groups
      // use these without the "p" suffix.
      if (elements_.empty(kElementVideoResolution)) {
        elements_.insert(kElementVideoResolution, token->content);
        token->category = kIdentifier;
        continue;
      }
    }
  }
}
	vector<string> findRepeatedDnaSequences(string s)
	{
		vector<string> res;
		if (s.length() < 10)
			return res;
		unordered_map<int, int> hash;
		for (int i = 0; i <= s.length() - 10; i++)
		{
			string sb = s.substr(i, 10);
			int c = StringToInt(sb);
			if (hash.find(c) == hash.end())
			{
				hash[c]++;
			}
			else
			{
				hash[c]++;
				if (hash[c] < 3)
				{
					res.push_back(s.substr(i, 10));
				}
			}
		}
		return res;
	}
Exemplo n.º 29
0
 int CMusikLibrary::db_callbackAddToSongIdArray(void *args, int WXUNUSED(numCols), char **results, char ** WXUNUSED(columnNames))
{

	
	MusikSongIdArray * p = (MusikSongIdArray*)args;
	p->Add(MusikSongId( StringToInt(results[0])));
    return 0;
}
int NASCToolBox::SubstringToInt( wstring wstr, int StartIndex, int EndIndex ) const
{
	wstring tmp;
	for( int i = StartIndex; i <= EndIndex; i ++ ) {
		tmp += wstr[ i ];
	}
	return StringToInt( tmp );
}