本文整理汇总了C++中WDL_FastString::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ WDL_FastString::Get方法的具体用法?C++ WDL_FastString::Get怎么用?C++ WDL_FastString::Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WDL_FastString
的用法示例。
在下文中一共展示了WDL_FastString::Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveCueBusIniFile
void SaveCueBusIniFile(int _confId, const char* _busName, int _type, bool _trTemplate, const char* _trTemplatePath, bool _showRouting, int _soloDefeat, bool _sendToMaster, int* _hwOuts)
{
if (_confId>=0 && _confId<SNM_MAX_CUE_BUSS_CONFS && _busName && _trTemplatePath && _hwOuts)
{
char iniSection[64]="";
if (_snprintfStrict(iniSection, sizeof(iniSection), "CueBuss%d", _confId+1) > 0)
{
char buf[16]="", slot[16]="";
WDL_FastString escapedStr;
escapedStr.SetFormatted(256, "\"%s\"", _busName);
WritePrivateProfileString(iniSection,"name",escapedStr.Get(),g_SNM_IniFn.Get());
if (_snprintfStrict(buf, sizeof(buf), "%d" ,_type) > 0)
WritePrivateProfileString(iniSection,"reatype",buf,g_SNM_IniFn.Get());
WritePrivateProfileString(iniSection,"track_template_enabled",_trTemplate ? "1" : "0",g_SNM_IniFn.Get());
escapedStr.SetFormatted(SNM_MAX_PATH, "\"%s\"", _trTemplatePath);
WritePrivateProfileString(iniSection,"track_template_path",escapedStr.Get(),g_SNM_IniFn.Get());
WritePrivateProfileString(iniSection,"show_routing",_showRouting ? "1" : "0",g_SNM_IniFn.Get());
WritePrivateProfileString(iniSection,"send_to_masterparent",_sendToMaster ? "1" : "0",g_SNM_IniFn.Get());
if (_snprintfStrict(buf, sizeof(buf), "%d", _soloDefeat) > 0)
WritePrivateProfileString(iniSection,"solo_defeat",buf,g_SNM_IniFn.Get());
for (int i=0; i<SNM_MAX_HW_OUTS; i++)
if (_snprintfStrict(slot, sizeof(slot), "hwout%d", i+1) > 0 && _snprintfStrict(buf, sizeof(buf), "%d", _hwOuts[i]) > 0)
WritePrivateProfileString(iniSection,slot,_hwOuts[i]?buf:NULL,g_SNM_IniFn.Get());
}
}
}
示例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;
}
示例3: IsEmpty
// different from checking a PCM source: this method deals with the chunk
bool SNM_TakeParserPatcher::IsEmpty(int _takeIdx)
{
WDL_FastString tkChunk;
if (GetTakeChunk(_takeIdx, &tkChunk))
return (
!strncmp(tkChunk.Get(), "TAKE NULL", 9) || // empty take
strstr(tkChunk.Get(), "<SOURCE EMPTY")); // take with an empty source
return false;
}
示例4: GlobalStartupActionTimer
// global action timer armed via SNM_Init()/OnInitTimer()
void GlobalStartupActionTimer()
{
if (int cmdId = NamedCommandLookup(g_globalAction.Get()))
{
Main_OnCommand(cmdId, 0);
#ifdef _SNM_DEBUG
OutputDebugString("GlobalStartupActionTimer() - Performed global startup action '");
OutputDebugString(g_globalAction.Get());
OutputDebugString("'\n");
#endif
}
}
示例5: 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);
}
}
}
示例6: FindFirstUnusedGroup
int FindFirstUnusedGroup()
{
bool grp[SNM_MAX_TRACK_GROUPS];
memset(grp, 0, sizeof(bool)*SNM_MAX_TRACK_GROUPS);
for (int i=0; i <= GetNumTracks(); i++) // incl. master
{
//JFB TODO? exclude selected tracks?
if (MediaTrack* tr = CSurf_TrackFromID(i, false))
{
SNM_ChunkParserPatcher p(tr);
WDL_FastString grpLine;
if (p.Parse(SNM_GET_SUBCHUNK_OR_LINE, 1, "TRACK", "GROUP_FLAGS", 0, 0, &grpLine, NULL, "TRACKHEIGHT"))
{
LineParser lp(false);
if (!lp.parse(grpLine.Get())) {
for (int j=1; j < lp.getnumtokens(); j++) { // skip 1st token GROUP_FLAGS
int val = lp.gettoken_int(j);
for (int k=0; k < SNM_MAX_TRACK_GROUPS; k++) {
int grpMask = int(pow(2.0, k*1.0));
grp[k] |= ((val & grpMask) == grpMask);
}
}
}
}
}
}
for (int i=0; i < SNM_MAX_TRACK_GROUPS; i++)
if (!grp[i]) return i;
return -1;
}
示例7: if
static LRESULT CALLBACK RulerWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_SETCURSOR && g_actionInProgress && g_actionInProgress->SetMouseCursor)
{
if (HCURSOR cursor = g_actionInProgress->SetMouseCursor(BR_ContinuousAction::RULER))
{
SetCursor(cursor);
return 1;
}
}
else if (uMsg == WM_MOUSEMOVE && g_actionInProgress && g_actionInProgress->SetTooltip)
{
WDL_FastString tooltip = g_actionInProgress->SetTooltip(BR_ContinuousAction::RULER);
if (tooltip.GetLength())
{
POINT p = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
ClientToScreen(hwnd, &p);
SetTooltip(tooltip.Get(), &p);
}
else
{
SetTooltip(NULL, NULL);
}
}
return g_rulerWndProc(hwnd, uMsg, wParam, lParam);
}
示例8: Progress
void BR_Timer::Progress (const char* message /*= NULL*/)
{
#ifdef WIN32
LARGE_INTEGER end, ticks;
QueryPerformanceCounter(&end);
QueryPerformanceFrequency(&ticks);
LARGE_INTEGER start = m_start;
if (m_paused) // in case timer is still paused
start.QuadPart += end.QuadPart - m_pause.QuadPart;
double msTime = (double)(end.QuadPart - start.QuadPart) * 1000 / (double)ticks.QuadPart;
#else
timeval end;
gettimeofday(&end, NULL);
timeval start = m_start;
if (m_paused) // in case timer is still paused
{
timeval temp;
timersub(&end, &m_pause, &temp);
timeradd(&m_start, &temp, &start);
}
double msTime = (double)(end.tv_sec - start.tv_sec) * 1000 + (double)(end.tv_usec - start.tv_usec) / 1000;
#endif
bool paused = m_paused;
this->Pause(); // ShowConsoleMsg wastes time and Progress can be called at any time during measurement
WDL_FastString string;
string.AppendFormatted(256, "%.3f ms to execute: %s\n", msTime, message ? message : m_message.Get());
ShowConsoleMsg(string.Get());
if (!paused) // resume only if time was not paused in the first place
this->Resume();
}
示例9: CommandTimer
void CommandTimer (COMMAND_T* ct, int val /*= 0*/, int valhw /*= 0*/, int relmode /*= 0*/, HWND hwnd /*= NULL*/, bool commandHook2 /*= false*/)
{
#ifdef WIN32
LARGE_INTEGER ticks, start, end;
QueryPerformanceFrequency(&ticks);
QueryPerformanceCounter(&start);
#else
timeval start, end;
gettimeofday(&start, NULL);
#endif
if (commandHook2)
ct->onAction(ct, val, valhw, relmode, hwnd);
else
ct->doCommand(ct);
#ifdef WIN32
QueryPerformanceCounter(&end);
int msTime = (int)((double)(end.QuadPart - start.QuadPart) * 1000 / (double)ticks.QuadPart + 0.5);
#else
gettimeofday(&end, NULL);
int msTime = (int)((double)(end.tv_sec - start.tv_sec) * 1000 + (double)(end.tv_usec - start.tv_usec) / 1000 + 0.5);
#endif
WDL_FastString string;
string.AppendFormatted(256, "%d ms to execute: %s\n", msTime, ct->accel.desc);
ShowConsoleMsg(string.Get());
}
示例10: ResolveMissingRecv
// Return TRUE on delete send
bool ResolveMissingRecv(MediaTrack* tr, int iSend, TrackSend* ts, WDL_PtrList<TrackSendFix>* pFix)
{
WDL_FastString str;
char* cName = (char*)GetSetMediaTrackInfo(tr, "P_NAME", NULL);
if (!cName || !cName[0])
cName = (char*)__LOCALIZE("(unnamed)","sws_DLG_114");
str.SetFormatted(200, __LOCALIZE_VERFMT("Send %d on track %d \"%s\" is missing its receive track!","sws_DLG_114"), iSend+1, CSurf_TrackToID(tr, false), cName);
g_cErrorStr = str.Get();
g_ts = ts;
g_send = tr;
g_recv = NULL;
DialogBox(g_hInst, MAKEINTRESOURCE(IDD_RECVMISSING), g_hwndParent, doResolve);
if (g_iResolveRet == 1)
return true;
else if (g_iResolveRet == 2)
{
GUID* newGuid = (GUID*)GetSetMediaTrackInfo(g_recv, "GUID", NULL);
if (pFix)
pFix->Add(new TrackSendFix(ts->GetGuid(), newGuid));
ts->SetGuid(newGuid);
}
return false;
}
示例11: 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;
}
示例12: ShowStartupActions
void ShowStartupActions(COMMAND_T* _ct)
{
WDL_FastString msg(__LOCALIZE("No project startup action is defined","sws_startup_action"));
if (int cmdId = SNM_NamedCommandLookup(g_prjActions.Get()->Get()))
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(".");
msg.Append("\r\n\r\n");
if (int cmdId = SNM_NamedCommandLookup(g_globalAction.Get()))
{
msg.AppendFormatted(512, __LOCALIZE_VERFMT("'%s' is defined as global startup action", "sws_startup_action"), kbd_getTextFromCmd(cmdId, NULL));
}
else
{
msg.Append(__LOCALIZE("No global startup action is defined","sws_startup_action"));
}
msg.Append(".");
MessageBox(GetMainHwnd(), msg.Get(), SWS_CMD_SHORTNAME(_ct), MB_OK);
}
示例13: SaveSingleTrackTemplateChunk
// appends _tr's state to _chunkOut
//JFB TODO: save envs with beat position info (like it is done for items)
void SaveSingleTrackTemplateChunk(MediaTrack* _tr, WDL_FastString* _chunkOut, bool _delItems, bool _delEnvs)
{
if (_tr && _chunkOut)
{
SNM_TrackEnvParserPatcher p(_tr, false); // no auto-commit!
if (_delEnvs)
p.RemoveEnvelopes();
// systematically remove items whatever is _delItems, then
// replace them with items + optional beat pos info, if !_delItems (i.e. mimic native templates)
p.RemoveSubChunk("ITEM", 2, -1);
_chunkOut->Append(p.GetChunk()->Get());
if (!_delItems)
{
double d;
WDL_FastString beatInfo;
for (int i=0; i<GetTrackNumMediaItems(_tr); i++)
{
if (MediaItem* item = GetTrackMediaItem(_tr, i))
{
SNM_ChunkParserPatcher pitem(item, false); // no auto-commit!
int posChunk = pitem.GetLinePos(1, "ITEM", "POSITION", 1, 0); // look for the *next* line
if (--posChunk>=0) { // --posChunk to zap "\n"
TimeMap2_timeToBeats(NULL, *(double*)GetSetMediaItemInfo(item, "D_POSITION", NULL), NULL, NULL, &d, NULL);
beatInfo.SetFormatted(32, " %.14f", d);
pitem.GetChunk()->Insert(beatInfo.Get(), posChunk);
}
posChunk = pitem.GetLinePos(1, "ITEM", "SNAPOFFS", 1, 0);
if (--posChunk>=0) {
TimeMap2_timeToBeats(NULL, *(double*)GetSetMediaItemInfo(item, "D_SNAPOFFSET", NULL), NULL, NULL, &d, NULL);
beatInfo.SetFormatted(32, " %.14f", d);
pitem.GetChunk()->Insert(beatInfo.Get(), posChunk);
}
posChunk = pitem.GetLinePos(1, "ITEM", "LENGTH", 1, 0);
if (--posChunk>=0) {
TimeMap2_timeToBeats(NULL, *(double*)GetSetMediaItemInfo(item, "D_LENGTH", NULL), NULL, NULL, &d, NULL);
beatInfo.SetFormatted(32, " %.14f", d);
pitem.GetChunk()->Insert(beatInfo.Get(), posChunk);
}
_chunkOut->Insert(pitem.GetChunk(), _chunkOut->GetLength()-2); // -2: before ">\n"
}
}
}
}
}
示例14: 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;
}
示例15: GetFXChain
// Functions for getting/setting track FX chains
void GetFXChain(MediaTrack* tr, WDL_TypedBuf<char>* buf)
{
SNM_ChunkParserPatcher p(tr);
WDL_FastString chainChunk;
if (p.GetSubChunk("FXCHAIN", 2, 0, &chainChunk, "<ITEM") > 0) {
buf->Resize(chainChunk.GetLength() + 1);
strcpy(buf->Get(), chainChunk.Get());
}
}