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


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

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


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

示例1: SetProjectStartupAction

void SetProjectStartupAction(COMMAND_T* _ct)
{
	if (PromptClearProjectStartupAction(false) == IDNO)
		return;

	char idstr[SNM_MAX_ACTION_CUSTID_LEN];
	lstrcpyn(idstr, __LOCALIZE("Paste command ID or identifier string here","sws_mbox"), 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))
			{
				msg.SetFormatted(256, __LOCALIZE_VERFMT("%s failed: unreliable command ID '%s'!","sws_DLG_161"), SWS_CMD_SHORTNAME(_ct), idstr);
				msg.Append("\n");

				// localization note: msgs shared with the CA editor
				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_mbox"));
				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_mbox"));
				MessageBox(GetMainHwnd(), msg.Get(), __LOCALIZE("S&M - Error","sws_DLG_161"), MB_OK);
			}
			else
			{
				g_prjActions.Get()->Set(idstr);
				Undo_OnStateChangeEx2(NULL, SWS_CMD_SHORTNAME(_ct), UNDO_STATE_MISCCFG, -1);

				msg.SetFormatted(256, __LOCALIZE_VERFMT("'%s' is defined as project startup action","sws_mbox"), kbd_getTextFromCmd(cmdId, NULL));
				char prjFn[SNM_MAX_PATH] = "";
				EnumProjects(-1, prjFn, sizeof(prjFn));
				if (*prjFn) {
					msg.Append("\n");
					msg.AppendFormatted(SNM_MAX_PATH, __LOCALIZE_VERFMT("for %s","sws_mbox"), prjFn);
				}
				msg.Append(".");
				MessageBox(GetMainHwnd(), msg.Get(), SWS_CMD_SHORTNAME(_ct), MB_OK);
			}
		}
		else
		{
			msg.SetFormatted(256, __LOCALIZE_VERFMT("%s failed: command ID or identifier string '%s' not found in the 'Main' section of the action list!","sws_DLG_161"), SWS_CMD_SHORTNAME(_ct), idstr);
			MessageBox(GetMainHwnd(), msg.Get(), __LOCALIZE("S&M - Error","sws_DLG_161"), MB_OK);
		}
	}
}
开发者ID:tweed,项目名称:sws,代码行数:48,代码来源:SnM_Project.cpp

示例2: 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

示例3: SetText

// split the text into lines and store them (not to do that in OnPaint()),
// empty lines are ignored
// _col: 0 to use the default theme text color
void SNM_DynSizedText::SetText(const char* _txt, int _col, unsigned char _alpha)
{ 
	if (m_col==_col && m_alpha==_alpha && !strcmp(m_lastText.Get(), _txt?_txt:""))
		return;

	m_lastText.Set(_txt?_txt:"");
	m_lines.Empty(true);
	m_maxLineIdx = -1;
	m_alpha = _alpha;
	m_col = _col ? LICE_RGBA_FROMNATIVE(_col, m_alpha) : 0;

	if (_txt && *_txt)
	{
		int maxLineLen=0, len;
		const char* p=_txt, *p2=NULL;
		while (p2 = FindFirstRN(p, true)) // \r or \n in any order (for OSX..)
		{
			if (len = (int)(p2-p))
			{
				if (len > maxLineLen) {
					maxLineLen = len;
					m_maxLineIdx = m_lines.GetSize();
				}

				WDL_FastString* line = new WDL_FastString;
				line->Append(p, len);
				m_lines.Add(line);
				p = p2+1;
			}

			while (*p && (*p == '\r' || *p == '\n')) p++;

			if (!*p) break;
		}
		if (p && *p && !p2)
		{
			WDL_FastString* s = new WDL_FastString(p);
			if (s->GetLength() > maxLineLen)
				m_maxLineIdx = m_lines.GetSize();
			m_lines.Add(s);
		}
	}
	m_lastFontH = -1; // will force font refresh
	RequestRedraw(NULL);
}
开发者ID:Breeder,项目名称:sws,代码行数:48,代码来源:SnM_VWnd.cpp

示例4: GetMarkerRegionDesc

bool GetMarkerRegionDesc(const char* _name, bool _isrgn, int _num, double _pos, double _end, int _flags, bool _wantNum, bool _wantName, bool _wantTime, char* _descOut, int _outSz)
{
	if (_descOut && _outSz &&
		((_isrgn && _flags&SNM_REGION_MASK) || (!_isrgn && _flags&SNM_MARKER_MASK)))
	{
		WDL_FastString desc;
		bool comma = !_wantNum;

		if (_wantNum)
			desc.SetFormatted(64, "%d", _num);

		if (_wantName && _name && *_name)
		{
			if (!comma) { desc.Append(": "); comma = true; }
			desc.Append(_name);
		}

		if (_wantTime)
		{
			if (!comma) { desc.Append(": "); comma = true; }
			char timeStr[64] = "";
			format_timestr_pos(_pos, timeStr, sizeof(timeStr), -1);
			desc.Append(" [");
			desc.Append(timeStr);
			if (_isrgn)
			{
				desc.Append(" -> ");
				format_timestr_pos(_end, timeStr, sizeof(timeStr), -1);
				desc.Append(timeStr);
			}
			desc.Append("]");
		}
		lstrcpyn(_descOut, desc.Get(), _outSz);
		return true;
	}
	return false;
}
开发者ID:AusRedNeck,项目名称:sws,代码行数:37,代码来源:SnM_Marker.cpp

示例5: onChar


//.........这里部分代码省略.........
          if (m_curs_y < 0) m_curs_y=0;

          preSaveUndoState();
          WDL_FastString poststr;
          int x;
          int indent_to_pos = -1;
          for (x = 0; x < lines.GetSize(); x ++)
          {
            WDL_FastString *str=m_text.Get(m_curs_y);
            const char *tstr=lines.Get(x);
            if (!tstr) tstr="";
            if (!x)
            {
              if (str)
              {
                if (m_curs_x < 0) m_curs_x=0;
                int tmp=str->GetLength();
                if (m_curs_x > tmp) m_curs_x=tmp;
  
                poststr.Set(str->Get()+m_curs_x);
                str->SetLen(m_curs_x);

                const char *p = str->Get();
                while (*p == ' ' || *p == '\t') p++;
                if (!*p && p > str->Get())
                {
                  if (lines.GetSize()>1)
                  {
                    while (*tstr == ' ' || *tstr == '\t') tstr++;
                  }
                  indent_to_pos = m_curs_x;
                }

                str->Append(tstr);
              }
              else
              {
                m_text.Insert(m_curs_y,(str=new WDL_FastString(tstr)));
              }
              if (lines.GetSize() > 1)
              {
                m_curs_y++;
              }
              else
              {
                m_curs_x = str->GetLength();
                str->Append(poststr.Get());
              }
           }
           else if (x == lines.GetSize()-1)
           {
             WDL_FastString *s=newIndentedFastString(tstr,indent_to_pos);
             m_curs_x = s->GetLength();
             s->Append(poststr.Get());
             m_text.Insert(m_curs_y,s);
           }
           else
           {
             m_text.Insert(m_curs_y,newIndentedFastString(tstr,indent_to_pos));
             m_curs_y++;
           }
         }
         draw();
         setCursor();
         draw_message("Pasted");
         saveUndoState();
开发者ID:fourthskyinteractive,项目名称:wdl-ol,代码行数:67,代码来源:curses_editor.cpp

示例6: 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

示例7: 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

示例8: CueBuss

// _type: 0=Post-Fader (Post-Pan), 1=Pre-FX, 2=deprecated, 3=Pre-Fader (Post-FX)
// _undoMsg: NULL=no undo
bool CueBuss(const char* _undoMsg, const char* _busName, int _type, bool _showRouting,
			 int _soloDefeat, char* _trTemplatePath, bool _sendToMaster, int* _hwOuts) 
{
	if (!SNM_CountSelectedTracks(NULL, false))
		return false;

	WDL_FastString tmplt;
	if (_trTemplatePath && (!FileOrDirExists(_trTemplatePath) || !LoadChunk(_trTemplatePath, &tmplt) || !tmplt.GetLength()))
	{
		char msg[SNM_MAX_PATH] = "";
		lstrcpyn(msg, __LOCALIZE("Cue buss not created!\nNo track template file defined","sws_DLG_149"), sizeof(msg));
		if (*_trTemplatePath)
			_snprintfSafe(msg, sizeof(msg), __LOCALIZE_VERFMT("Cue buss not created!\nTrack template not found (or empty): %s","sws_DLG_149"), _trTemplatePath);
		MessageBox(GetMainHwnd(), msg, __LOCALIZE("S&M - Error","sws_DLG_149"), MB_OK);
		return false;
	}

	bool updated = false;
	MediaTrack * cueTr = NULL;
	SNM_SendPatcher* p = NULL;
	for (int i=1; i <= GetNumTracks(); i++) // skip master
	{
		MediaTrack* tr = CSurf_TrackFromID(i, false);
		if (tr && *(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL))
		{
			GetSetMediaTrackInfo(tr, "I_SELECTED", &g_i0);

			// add the buss track, done once!
			if (!cueTr)
			{
				InsertTrackAtIndex(GetNumTracks(), false);
				TrackList_AdjustWindows(false);
				cueTr = CSurf_TrackFromID(GetNumTracks(), false);
				GetSetMediaTrackInfo(cueTr, "P_NAME", (void*)_busName);

				p = new SNM_SendPatcher(cueTr);

				if (tmplt.GetLength())
				{
					WDL_FastString chunk;
					MakeSingleTrackTemplateChunk(&tmplt, &chunk, true, true, false);
					ApplyTrackTemplate(cueTr, &chunk, false, false, p);
				}
				updated = true;
			}

			// add a send
			if (cueTr && p && tr != cueTr)
				AddReceiveWithVolPan(tr, cueTr, _type, p);
		}
	}

	if (cueTr && p)
	{
		// send to master/parent init
		if (!tmplt.GetLength())
		{
			// solo defeat
			if (_soloDefeat) {
				char one[2] = "1";
				updated |= (p->ParsePatch(SNM_SET_CHUNK_CHAR, 1, "TRACK", "MUTESOLO", 0, 3, one) > 0);
			}
			
			// master/parend send
			WDL_FastString mainSend;
			mainSend.SetFormatted(SNM_MAX_CHUNK_LINE_LENGTH, "MAINSEND %d 0", _sendToMaster?1:0);

			// adds hw outputs
			if (_hwOuts)
			{
				int monoHWCount=0; 
				while (GetOutputChannelName(monoHWCount)) monoHWCount++;

				bool cr = false;
				for(int i=0; i<SNM_MAX_HW_OUTS; i++)
				{
					if (_hwOuts[i])
					{
						if (!cr) {
							mainSend.Append("\n"); 
							cr = true;
						}
						if (_hwOuts[i] >= monoHWCount) 
							mainSend.AppendFormatted(32, "HWOUT %d ", (_hwOuts[i]-monoHWCount) | 1024);
						else
							mainSend.AppendFormatted(32, "HWOUT %d ", _hwOuts[i]-1);

						mainSend.Append("0 ");
						mainSend.AppendFormatted(20, "%.14f ", *(double*)GetConfigVar("defhwvol"));
						mainSend.Append("0.00000000000000 0 0 0 -1.00000000000000 -1\n");
					}
				}
				if (!cr)
					mainSend.Append("\n"); // hot
			}

			// patch both updates (no break keyword here: new empty track)
			updated |= p->ReplaceLine("TRACK", "MAINSEND", 1, 0, mainSend.Get());
//.........这里部分代码省略.........
开发者ID:Jeff0S,项目名称:sws,代码行数:101,代码来源:SnM_CueBuss.cpp


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