当前位置: 首页>>代码示例>>C++>>正文


C++ WDL_FastString::Set方法代码示例

本文整理汇总了C++中WDL_FastString::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ WDL_FastString::Set方法的具体用法?C++ WDL_FastString::Set怎么用?C++ WDL_FastString::Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WDL_FastString的用法示例。


在下文中一共展示了WDL_FastString::Set方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char **argv)
{
  if (argc != 2) { fprintf(stderr,"usage: preproc_test filename\n"); return 0; }
  FILE *fp =fopen(argv[1],"rb");
  if (!fp)  { fprintf(stderr,"error opening '%s'\n",argv[1]); return 1; }

  int insec=0;
  WDL_FastString cursec;
  for (;;)
  {
    char buf[4096];
    buf[0]=0;
    fgets(buf,sizeof(buf),fp);
    if (!buf[0]) break;
    char *p=buf;
    while (*p == ' ' || *p == '\t') p++;
    if (p[0] == '@') 
    {
      insec=1;
      if (ppOut((char*)cursec.Get())) { fprintf(stderr,"Error preprocessing %s!\n",argv[1]); return -1; }
      cursec.Set("");
    }
    else if (insec)
    {
      cursec.Append(buf);
      continue;
    }
    printf("%s",buf);
  }
  if (ppOut((char*)cursec.Get())) { fprintf(stderr,"Error preprocessing %s!\n",argv[1]); return -1; }

  fclose(fp);
  return 0;
}
开发者ID:Brado231,项目名称:Faderport_XT,代码行数:34,代码来源:preproc_test.cpp

示例2: runcode

int sInst::runcode(const char *code, bool showerr, bool canfree)
{
  if (m_vm) 
  {
    m_pc.Set("");
    eel_preprocess_strings(this,m_pc,code);
    NSEEL_CODEHANDLE code = NSEEL_code_compile_ex(m_vm,m_pc.Get(),1,canfree ? 0 : NSEEL_CODE_COMPILE_FLAG_COMMONFUNCS);
    char *err;
    if (!code && (err=NSEEL_code_getcodeerror(m_vm)))
    {
      if (NSEEL_code_geterror_flag(m_vm)&1) return 1;
      if (showerr) fprintf(stderr,"NSEEL_code_compile: %s\n",err);
      return -1;
    }
    else
    {
      if (code)
      {
        NSEEL_VM_enumallvars(m_vm,varEnumProc, this);
        NSEEL_code_execute(code);
        if (canfree) NSEEL_code_free(code);
        else m_code_freelist.Add((void*)code);
      }
      return 0;
    }
  }
  return -1;
}
开发者ID:robksawyer,项目名称:autotalent_64bit_osx,代码行数:28,代码来源:test.cpp

示例3: SNM_ProjectInit

int SNM_ProjectInit()
{
  char buf[SNM_MAX_ACTION_CUSTID_LEN]="";
  GetPrivateProfileString("Misc", "GlobalStartupAction", "", buf, sizeof(buf), g_SNM_IniFn.Get());
  g_globalAction.Set(buf);
  return plugin_register("projectconfig", &s_projectconfig);
}
开发者ID:AusRedNeck,项目名称:sws,代码行数:7,代码来源:SnM_Project.cpp

示例4: CopyCutTrackGrouping

void CopyCutTrackGrouping(COMMAND_T* _ct)
{
	int updates = 0;
	bool copyDone = false;
	g_trackGrpClipboard.Set(""); // reset "clipboard"
	for (int i=0; i <= GetNumTracks(); i++) // incl. master
	{
		MediaTrack* tr = CSurf_TrackFromID(i, false);
		if (tr && *(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL))
		{
			SNM_ChunkParserPatcher p(tr);
			if (!copyDone)
				copyDone = (p.Parse(SNM_GET_SUBCHUNK_OR_LINE, 1, "TRACK", "GROUP_FLAGS", 0, 0, &g_trackGrpClipboard, NULL, "MAINSEND") > 0);

			// cut (for all selected tracks)
			if ((int)_ct->user)
				updates += p.RemoveLines("GROUP_FLAGS", true); // brutal removing ok: "GROUP_FLAGS" is not part of freeze data
			// single copy: the 1st found track grouping
			else if (copyDone)
				break;
		}
	}
	if (updates)
		Undo_OnStateChangeEx2(NULL, SWS_CMD_SHORTNAME(_ct), UNDO_STATE_ALL, -1);
}
开发者ID:AusRedNeck,项目名称:sws,代码行数:25,代码来源:SnM_Track.cpp

示例5: SetFXChain

void SetFXChain(MediaTrack* tr, const char* str)
{
	SNM_FXChainTrackPatcher p(tr);
	WDL_FastString chainChunk;
	// adapt FX chain format (the SNM_FXChainTrackPatcher uses the .RFXChain file format)
	if (str && !strncmp(str, "<FXCHAIN", 8)) {
		chainChunk.Set(strchr(str, '\n') + 1); // removes the line starting with "<FXCHAIN"
		chainChunk.SetLen(chainChunk.GetLength()-2); // remove trailing ">\n"
	}
	p.SetFXChain(str ? &chainChunk : NULL);
}
开发者ID:AusRedNeck,项目名称:sws,代码行数:11,代码来源:TrackFX.cpp

示例6: FileOrDirExists

// the API function file_exists() is a bit different, it returns false for folders
bool FileOrDirExists(const char* _fn)
{
	if (_fn && *_fn && *_fn!='.') // valid absolute path (1/2)?
	{
		if (const char* p = strrchr(_fn, PATH_SLASH_CHAR)) // valid absolute path (2/2)?
		{
			WDL_FastString fn;
			fn.Set(_fn, *(p+1)? 0 : (int)(p-_fn)); // // bug fix for directories, skip last PATH_SLASH_CHAR if needed
			struct stat s;
#ifdef _WIN32
			return (statUTF8(fn.Get(), &s) == 0);
#else
			return (stat(fn.Get(), &s) == 0);
#endif
		}
	}
	return false;
}
开发者ID:pottootje1982,项目名称:recorded-midi-cleaner,代码行数:19,代码来源:SnM_Util.cpp

示例7: ClearStartupAction

void ClearStartupAction(COMMAND_T* _ct)
{
	int type=(int)_ct->user;
  
	if (PromptClearStartupAction(type, true)==IDYES)
	{
		if (!type)
		{
			g_prjActions.Get()->Set("");
			Undo_OnStateChangeEx2(NULL, SWS_CMD_SHORTNAME(_ct), UNDO_STATE_MISCCFG, -1);
		}
		else
		{
			g_globalAction.Set("");
			WritePrivateProfileString("Misc", "GlobalStartupAction", NULL, g_SNM_IniFn.Get()); 
		}
	}
}
开发者ID:AusRedNeck,项目名称:sws,代码行数:18,代码来源:SnM_Project.cpp

示例8: onChar


//.........这里部分代码省略.........
          char buf[512];
          snprintf(buf,sizeof(buf),"Redid action - %d items in redo buffer",m_undoStack.GetSize()-m_undoStack_pos-1);
          draw_message(buf);
        }
        else 
        {
          draw_message("Can't Redo");  
        }
      }
    break;
    case KEY_IC:
      if (!SHIFT_KEY_DOWN && !ALT_KEY_DOWN)
      {
        s_overwrite=!s_overwrite;
        setCursor();
        break;
      }
      // fqll through
    case 'V'-'A'+1:
      if (!SHIFT_KEY_DOWN && !ALT_KEY_DOWN)
      {
        // generate a m_clipboard using win32 clipboard data
        WDL_PtrList<const char> lines;
        WDL_String buf;
#ifdef WDL_IS_FAKE_CURSES
        if (CURSES_INSTANCE)
        {
          OpenClipboard(CURSES_INSTANCE->m_hwnd);
          HANDLE h=GetClipboardData(CF_TEXT);
          if (h)
          {
            char *t=(char *)GlobalLock(h);
            int s=GlobalSize(h);
            buf.Set(t,s);
            GlobalUnlock(t);        
          }
          CloseClipboard();
        }
        else
#endif
        {
          buf.Set(s_fake_clipboard.Get());
        }

        if (buf.Get() && buf.Get()[0])
        {
          char *src=buf.Get();
          while (*src)
          {
            char *seek=src;
            while (*seek && *seek != '\r' && *seek != '\n') seek++;
            char hadclr=*seek;
            if (*seek) *seek++=0;
            lines.Add(src);

            if (hadclr == '\r' && *seek == '\n') seek++;

            if (hadclr && !*seek)
            {
              lines.Add("");
            }
            src=seek;
          }
        }
        if (lines.GetSize())
        {
开发者ID:fourthskyinteractive,项目名称:wdl-ol,代码行数:67,代码来源:curses_editor.cpp

示例9: SetStartupAction

void SetStartupAction(COMMAND_T* _ct)
{
	int type=(int)_ct->user;

	if (PromptClearStartupAction(type, false) == IDNO)
		return;

	char idstr[SNM_MAX_ACTION_CUSTID_LEN];
	lstrcpyn(idstr, __LOCALIZE("Paste command ID or identifier string here","sws_startup_action"), sizeof(idstr));
	if (PromptUserForString(GetMainHwnd(), SWS_CMD_SHORTNAME(_ct), idstr, sizeof(idstr), true))
	{
		WDL_FastString msg;
		if (int cmdId = SNM_NamedCommandLookup(idstr))
		{
			// more checks: http://forum.cockos.com/showpost.php?p=1252206&postcount=1618
			if (int tstNum = CheckSwsMacroScriptNumCustomId(idstr))
			{
				// localization note: msgs shared with the CA editor
				msg.SetFormatted(512, __LOCALIZE_VERFMT("%s failed: unreliable command ID '%s'!","sws_startup_action"), SWS_CMD_SHORTNAME(_ct), idstr);
				msg.Append("\r\n");

				if (tstNum==-1)
					msg.Append(__LOCALIZE("For SWS/S&M actions, you must use identifier strings (e.g. _SWS_ABOUT), not command IDs (e.g. 47145).\nTip: to copy such identifiers, right-click the action in the Actions window > Copy selected action cmdID/identifier string.","sws_startup_action"));
				else if (tstNum==-2)
					msg.Append(__LOCALIZE("For macros/scripts, you must use identifier strings (e.g. _f506bc780a0ab34b8fdedb67ed5d3649), not command IDs (e.g. 47145).\nTip: to copy such identifiers, right-click the macro/script in the Actions window > Copy selected action cmdID/identifier string.","sws_startup_action"));
				MessageBox(GetMainHwnd(), msg.Get(), __LOCALIZE("S&M - Error","sws_mbox"), MB_OK);
			}
			else
			{
				if (!type)
				{
					g_prjActions.Get()->Set(idstr);
					Undo_OnStateChangeEx2(NULL, SWS_CMD_SHORTNAME(_ct), UNDO_STATE_MISCCFG, -1);

					msg.SetFormatted(512, __LOCALIZE_VERFMT("'%s' is defined as project startup action","sws_startup_action"), kbd_getTextFromCmd(cmdId, NULL));          
					char prjFn[SNM_MAX_PATH] = "";
					EnumProjects(-1, prjFn, sizeof(prjFn));
					if (*prjFn)
					{
						msg.Append("\r\n");
						msg.AppendFormatted(SNM_MAX_PATH, __LOCALIZE_VERFMT("for %s","sws_startup_action"), prjFn);
						msg.Append(".\r\n\r\n");
						msg.Append(__LOCALIZE("Note: do not forget to save this project","sws_startup_action"));
					}
				}
				else
				{
					g_globalAction.Set(idstr);
					WritePrivateProfileString("Misc", "GlobalStartupAction", idstr, g_SNM_IniFn.Get()); 

					msg.SetFormatted(512, __LOCALIZE_VERFMT("'%s' is defined as global startup action","sws_startup_action"), kbd_getTextFromCmd(cmdId, NULL));
				}
				msg.Append(".");
				MessageBox(GetMainHwnd(), msg.Get(), SWS_CMD_SHORTNAME(_ct), MB_OK);
			}
		}
		else
		{
			msg.SetFormatted(512, __LOCALIZE_VERFMT("%s failed: command ID or identifier string '%s' not found in the 'Main' section of the action list!","sws_startup_action"), SWS_CMD_SHORTNAME(_ct), idstr);
			MessageBox(GetMainHwnd(), msg.Get(), __LOCALIZE("S&M - Error","sws_mbox"), MB_OK);
		}
	}
}
开发者ID:AusRedNeck,项目名称:sws,代码行数:63,代码来源:SnM_Project.cpp

示例10: OpenFileInTab

void MultiTab_Editor::OpenFileInTab(const char *fnp)
{
  // try to find file to open
  WDL_FastString s;        
  FILE *fp=NULL;
  {
    const char *ptr = fnp;
    while (!fp && *ptr)
    {          
      // first try same path as loading effect
      if (m_filename.Get()[0])
      {
        s.Set(m_filename.Get());
        const char *sp=s.Get()+s.GetLength();
        while (sp>=s.Get() && *sp != '\\' && *sp != '/') sp--;
        s.SetLen(sp + 1 - s.Get());
        if (s.GetLength())
        {
          s.Append(ptr);
          fp=fopenUTF8(s.Get(),"rb");
        }
      }

      // scan past any / or \\, and try again
      if (!fp)
      {
        while (*ptr && *ptr != '\\' && *ptr != '/') ptr++;
        if (*ptr) ptr++;
      }
    }
  }

  if (!fp) 
  {
    s.Set("");
    fp = tryToFindOrCreateFile(fnp,&s);
  }

  if (!fp && s.Get()[0])
  {
    m_newfn.Set(s.Get());

    if (COLS > 25)
    {
      int allowed = COLS-25;
      if (s.GetLength()>allowed)
      {
        s.DeleteSub(0,s.GetLength() - allowed + 3);
        s.Insert("...",0);
      }
      s.Insert("Create new file '",0);
      s.Append("' (Y/n)? ");
    }
    else
      s.Set("Create new file (Y/n)? ");

    m_state=UI_STATE_SAVE_AS_NEW;
    attrset(m_color_message);
    bkgdset(m_color_message);
    mvaddstr(LINES-1,0,s.Get());
    clrtoeol();
    attrset(0);
    bkgdset(0);
  }
  else if (fp)
  {
    fclose(fp);
    int x;
    for (x=0;x<GetTabCount();x++)
    {
      MultiTab_Editor *e = GetTab(x);
      if (e && !stricmp(e->GetFileName(),s.Get()))
      {
        SwitchTab(x,false);
        return;
      }
    }
    AddTab(s.Get());
  }
}
开发者ID:AdrianGin,项目名称:Pathogen,代码行数:80,代码来源:multitab_edit.cpp

示例11: UpdateReaper

void TrackSends::UpdateReaper(MediaTrack* tr, WDL_PtrList<TrackSendFix>* pFix)
{
	// First replace all the hw sends with the stored
	const char* trackStr = SWS_GetSetObjectState(tr, NULL);
	WDL_FastString newTrackStr;
	char line[4096];
	int pos = 0;
	bool bChanged = false;
	while (GetChunkLine(trackStr, line, 4096, &pos, true))
	{
		if (strncmp(line, "HWOUT", 5) != 0)
			newTrackStr.Append(line);
		else
			bChanged = true;
	}
	for (int i = 0; i < m_hwSends.GetSize(); i++)
	{
		bChanged = true;
		AppendChunkLine(&newTrackStr, m_hwSends.Get(i)->Get());
	}

	SWS_FreeHeapPtr(trackStr);
	if (bChanged)
		SWS_GetSetObjectState(tr, &newTrackStr);

	// Check for destination track validity
	for (int i = 0; i < m_sends.GetSize(); i++)
		if (!GuidToTrack(m_sends.Get(i)->GetGuid()))
		{
			bool bFixed = false;
			if (pFix)
			{
				for (int j = 0; j < pFix->GetSize(); j++)
					if (GuidsEqual(&pFix->Get(j)->m_oldGuid, m_sends.Get(i)->GetGuid()))
					{
						m_sends.Get(i)->SetGuid(&pFix->Get(j)->m_newGuid);
						bFixed = true;
						break;
					}
			}
			if (!bFixed)
			{
				GUID newGuid = GUID_NULL;
				int iRet = ResolveMissingRecv(tr, i, m_sends.Get(i), pFix);
				if (iRet == 1) // Success!
					m_sends.Get(i)->SetGuid(&newGuid);
				else if (iRet == 2) // Delete
				{
					m_sends.Delete(i, true);
					i--;
				}
			}
		}

	// Now, delete any existing sends and add as necessary
	// Loop through each track
	char searchStr[20];
	sprintf(searchStr, "AUXRECV %d", CSurf_TrackToID(tr, false) - 1);
	WDL_FastString sendStr;
	GUID* trGuid = (GUID*)GetSetMediaTrackInfo(tr, "GUID", NULL);
	for (int i = 1; i <= GetNumTracks(); i++)
	{
		MediaTrack* pDest = CSurf_TrackFromID(i, false);
		newTrackStr.Set("");
		trackStr = NULL;
		MediaTrack* pSrc;
		int idx = 0;
		while ((pSrc = (MediaTrack*)GetSetTrackSendInfo(pDest, -1, idx++, "P_SRCTRACK", NULL)))
			if (pSrc == tr)
			{
				trackStr = SWS_GetSetObjectState(pDest, NULL);
				pos = 0;
				// Remove existing recvs from the src track
				while (GetChunkLine(trackStr, line, 4096, &pos, true))
				{
					if (strncmp(line, searchStr, strlen(searchStr)) != 0)
						newTrackStr.Append(line);
				}
				break;
			}

		GUID guid = *(GUID*)GetSetMediaTrackInfo(pDest, "GUID", NULL);
		for (int i = 0; i < m_sends.GetSize(); i++)
		{
			if (GuidsEqual(&guid, m_sends.Get(i)->GetGuid()) && !GuidsEqual(&guid, trGuid))
			{
				if (!trackStr)
				{
					trackStr = SWS_GetSetObjectState(pDest, NULL);
					newTrackStr.Set(trackStr);
				}
				AppendChunkLine(&newTrackStr, m_sends.Get(i)->AuxRecvString(tr, &sendStr)->Get());
			}
		}

		if (trackStr)
		{
			SWS_GetSetObjectState(pDest, &newTrackStr);
			SWS_FreeHeapPtr(trackStr);
		}
//.........这里部分代码省略.........
开发者ID:AusRedNeck,项目名称:sws,代码行数:101,代码来源:TrackSends.cpp

示例12: SaveSelTrackTemplates

// supports folders, multi-selection and routings between tracks too
void SaveSelTrackTemplates(bool _delItems, bool _delEnvs, WDL_FastString* _chunkOut)
{
	if (!_chunkOut)
		return;

	WDL_PtrList<MediaTrack> tracks;

	// append selected track chunks (+ folders) -------------------------------
	for (int i=0; i <= GetNumTracks(); i++) // incl. master
	{
		MediaTrack* tr = CSurf_TrackFromID(i, false);
		if (tr && *(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL))
		{
			SaveSingleTrackTemplateChunk(tr, _chunkOut, _delItems, _delEnvs);
			tracks.Add(tr);

			// folder: save child templates
			WDL_PtrList<MediaTrack>* childTracks = GetChildTracks(tr);
			if (childTracks)
			{
				for (int j=0; j < childTracks->GetSize(); j++) {
					SaveSingleTrackTemplateChunk(childTracks->Get(j), _chunkOut, _delItems, _delEnvs);
					tracks.Add(childTracks->Get(j));
				}
				i += childTracks->GetSize(); // skip children
				delete childTracks;
			}
		}
	}

	// update receives ids ----------------------------------------------------
	// no break keyword used here: multiple tracks in the template
	SNM_ChunkParserPatcher p(_chunkOut);
	WDL_FastString line;
	int occurence = 0;
	int pos = p.Parse(SNM_GET_SUBCHUNK_OR_LINE, 1, "TRACK", "AUXRECV", occurence, 1, &line); 
	while (pos > 0)
	{
		pos--; // see SNM_ChunkParserPatcher

		bool replaced = false;
		line.SetLen(line.GetLength()-1); // remove trailing '\n'
		LineParser lp(false);
		if (!lp.parse(line.Get()) && lp.getnumtokens() > 1)
		{
			int success, curId = lp.gettoken_int(1, &success);
			if (success)
			{
				MediaTrack* tr = CSurf_TrackFromID(curId+1, false);
				int newId = tracks.Find(tr);
				if (newId >= 0)
				{
					const char* p3rdTokenToEol = strchr(line.Get(), ' ');
					if (p3rdTokenToEol) p3rdTokenToEol = strchr((char*)(p3rdTokenToEol+1), ' ');
					if (p3rdTokenToEol)
					{
						WDL_FastString newRcv;
						newRcv.SetFormatted(SNM_MAX_CHUNK_LINE_LENGTH, "AUXRECV %d%s\n", newId, p3rdTokenToEol);
						replaced = p.ReplaceLine(pos, newRcv.Get());
						if (replaced)
							occurence++;
					}
				}
			}
		}

		if (!replaced)
			replaced = p.ReplaceLine(pos, "");
		if (!replaced) // skip, just in case..
			occurence++;

		line.Set("");
		pos = p.Parse(SNM_GET_SUBCHUNK_OR_LINE, 1, "TRACK", "AUXRECV", occurence, 1, &line);
	}
}
开发者ID:AusRedNeck,项目名称:sws,代码行数:76,代码来源:SnM_Track.cpp


注:本文中的WDL_FastString::Set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。