本文整理汇总了C++中MelderString_copy函数的典型用法代码示例。如果您正苦于以下问题:C++ MelderString_copy函数的具体用法?C++ MelderString_copy怎么用?C++ MelderString_copy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MelderString_copy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: NativeMenuItem_setText
static void NativeMenuItem_setText (GuiObject me) {
int acc = my motiff.pushButton.acceleratorChar, modifiers = my motiff.pushButton.acceleratorModifiers;
static MelderString title { 0 };
if (acc == 0) {
MelderString_copy (& title, _GuiWin_expandAmpersands (my name));
} else {
static const char32 *keyStrings [256] = {
0, U"<-", U"->", U"Up", U"Down", U"PAUSE", U"Del", U"Ins", U"Backspace", U"Tab", U"LineFeed", U"Home", U"End", U"Enter", U"PageUp", U"PageDown",
U"Esc", U"F1", U"F2", U"F3", U"F4", U"F5", U"F6", U"F7", U"F8", U"F9", U"F10", U"F11", U"F12", 0, 0, 0,
U"Space", U"!", U"\"", U"#", U"$", U"%", U"&", U"\'", U"(", U")", U"*", U"+", U",", U"-", U".", U"/",
U"0", U"1", U"2", U"3", U"4", U"5", U"6", U"7", U"8", U"9", U":", U";", U"<", U"=", U">", U"?",
U"@", U"A", U"B", U"C", U"D", U"E", U"F", U"G", U"H", U"I", U"J", U"K", U"L", U"M", U"N", U"O",
U"P", U"Q", U"R", U"S", U"T", U"U", U"V", U"W", U"X", U"Y", U"Z", U"[", U"\\", U"]", U"^", U"_",
U"`", U"a", U"b", U"c", U"d", U"e", U"f", U"g", U"h", U"i", U"j", U"k", U"l", U"m", U"n", U"o",
U"p", U"q", U"r", U"s", U"t", U"u", U"v", U"w", U"x", U"y", U"z", U"{", U"|", U"}", U"~", U"Del",
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, U"[", U"]", U",", U"?", U".", U"\\",
U";", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, U"-", U"`", U"=", U"\'", 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
const char32 *keyString = keyStrings [acc] ? keyStrings [acc] : U"???";
MelderString_copy (& title, _GuiWin_expandAmpersands (my name), U"\t",
modifiers & _motif_COMMAND_MASK ? U"Ctrl-" : nullptr,
modifiers & _motif_OPTION_MASK ? U"Alt-" : nullptr,
modifiers & _motif_SHIFT_MASK ? U"Shift-" : nullptr, keyString);
}
ModifyMenu (my nat.entry.handle, my nat.entry.id, MF_BYCOMMAND | MF_STRING, my nat.entry.id, Melder_peek32toW (title.string));
}
开发者ID:READSEARCH,项目名称:praat,代码行数:31,代码来源:GuiMenuItem.cpp
示例2: Thing_messageName
char32 * Thing_messageName (Thing me) {
static MelderString buffers [19] { { 0 } };
static int ibuffer = 0;
if (++ ibuffer == 19) ibuffer = 0;
if (my name) {
MelderString_copy (& buffers [ibuffer], my classInfo -> className, U" \"", my name, U"\"");
} else {
MelderString_copy (& buffers [ibuffer], my classInfo -> className);
}
return buffers [ibuffer]. string;
}
开发者ID:jjatria,项目名称:praat,代码行数:11,代码来源:Thing.cpp
示例3: NativeMenuItem_setText
static void NativeMenuItem_setText (GuiObject me) {
int acc = my motiff.pushButton.acceleratorChar, modifiers = my motiff.pushButton.acceleratorModifiers;
#if win
static MelderString title { 0 };
if (acc == 0) {
MelderString_copy (& title, _GuiWin_expandAmpersands (my name));
} else {
static const char32 *keyStrings [256] = {
0, U"<-", U"->", U"Up", U"Down", U"PAUSE", U"Del", U"Ins", U"Backspace", U"Tab", U"LineFeed", U"Home", U"End", U"Enter", U"PageUp", U"PageDown",
U"Esc", U"F1", U"F2", U"F3", U"F4", U"F5", U"F6", U"F7", U"F8", U"F9", U"F10", U"F11", U"F12", 0, 0, 0,
U"Space", U"!", U"\"", U"#", U"$", U"%", U"&", U"\'", U"(", U")", U"*", U"+", U",", U"-", U".", U"/",
U"0", U"1", U"2", U"3", U"4", U"5", U"6", U"7", U"8", U"9", U":", U";", U"<", U"=", U">", U"?",
U"@", U"A", U"B", U"C", U"D", U"E", U"F", U"G", U"H", U"I", U"J", U"K", U"L", U"M", U"N", U"O",
U"P", U"Q", U"R", U"S", U"T", U"U", U"V", U"W", U"X", U"Y", U"Z", U"[", U"\\", U"]", U"^", U"_",
U"`", U"a", U"b", U"c", U"d", U"e", U"f", U"g", U"h", U"i", U"j", U"k", U"l", U"m", U"n", U"o",
U"p", U"q", U"r", U"s", U"t", U"u", U"v", U"w", U"x", U"y", U"z", U"{", U"|", U"}", U"~", U"Del",
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, U"[", U"]", U",", U"?", U".", U"\\",
U";", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, U"-", U"`", U"=", U"\'", 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
const char32 *keyString = keyStrings [acc] ? keyStrings [acc] : U"???";
MelderString_copy (& title, _GuiWin_expandAmpersands (my name), U"\t",
modifiers & _motif_COMMAND_MASK ? U"Ctrl-" : nullptr,
modifiers & _motif_OPTION_MASK ? U"Alt-" : nullptr,
modifiers & _motif_SHIFT_MASK ? U"Shift-" : nullptr, keyString);
}
ModifyMenu (my nat.entry.handle, my nat.entry.id, MF_BYCOMMAND | MF_STRING, my nat.entry.id, Melder_peek32toW (title.string));
#elif mac
static int theGlyphs [1+31] = { 0,
kMenuLeftArrowDashedGlyph, kMenuRightArrowDashedGlyph, kMenuUpArrowDashedGlyph, kMenuDownwardArrowDashedGlyph, 0,
kMenuDeleteRightGlyph, 0, kMenuDeleteLeftGlyph, kMenuTabRightGlyph, 0,
0, 0, kMenuReturnGlyph, kMenuPageUpGlyph, kMenuPageDownGlyph,
kMenuEscapeGlyph, kMenuF1Glyph, kMenuF2Glyph, kMenuF3Glyph, kMenuF4Glyph,
kMenuF5Glyph, kMenuF6Glyph, kMenuF7Glyph, kMenuF8Glyph, kMenuF9Glyph,
kMenuF10Glyph, kMenuF11Glyph, kMenuF12Glyph, 0, 0,
0 };
SetMenuItemTextWithCFString (my nat.entry.handle, my nat.entry.item, (CFStringRef) Melder_peek32toCfstring (my name));
if (acc > 32) {
SetItemCmd (my nat.entry.handle, my nat.entry.item, acc);
} else {
Melder_assert (acc > 0 && acc < 32);
SetItemCmd (my nat.entry.handle, my nat.entry.item, ' '); /* Funny that this should be needed. */
SetMenuItemKeyGlyph (my nat.entry.handle, my nat.entry.item, theGlyphs [acc]);
}
SetMenuItemModifiers (my nat.entry.handle, my nat.entry.item,
( modifiers & _motif_OPTION_MASK ? kMenuOptionModifier : 0 ) +
( modifiers & _motif_SHIFT_MASK ? kMenuShiftModifier : 0 ) +
( modifiers & _motif_COMMAND_MASK ? 0 : kMenuNoCommandModifier ));
#endif
}
开发者ID:eginhard,项目名称:praat,代码行数:54,代码来源:GuiMenuItem.cpp
示例4: TableOfReal_writeToHeaderlessSpreadsheetFile
void TableOfReal_writeToHeaderlessSpreadsheetFile (TableOfReal me, MelderFile file) {
try {
autoMelderString buffer;
MelderString_copy (& buffer, L"rowLabel");
for (long icol = 1; icol <= my numberOfColumns; icol ++) {
MelderString_appendCharacter (& buffer, '\t');
wchar_t *s = my columnLabels [icol];
MelderString_append (& buffer, s != NULL && s [0] != '\0' ? s : L"?");
}
MelderString_appendCharacter (& buffer, '\n');
for (long irow = 1; irow <= my numberOfRows; irow ++) {
wchar_t *s = my rowLabels [irow];
MelderString_append (& buffer, s != NULL && s [0] != '\0' ? s : L"?");
for (long icol = 1; icol <= my numberOfColumns; icol ++) {
MelderString_appendCharacter (& buffer, '\t');
double x = my data [irow] [icol];
MelderString_append (& buffer, Melder_double (x));
}
MelderString_appendCharacter (& buffer, '\n');
}
MelderFile_writeText (file, buffer.string, Melder_getOutputEncoding ());
} catch (MelderError) {
Melder_throw (me, ": not saved to tab-separated file.");
}
}
开发者ID:arizona-phonological-imaging-lab,项目名称:ultrapraat,代码行数:25,代码来源:TableOfReal.cpp
示例5: v_draw
void structOTMultiEditor :: v_draw () {
OTMulti grammar = (OTMulti) data;
static MelderString buffer { 0 };
double rowHeight = 0.25, tableauHeight = 2 * rowHeight;
Graphics_clearWs (g);
HyperPage_listItem (this, U"\t\t %%ranking value\t %disharmony\t %plasticity");
for (long icons = 1; icons <= grammar -> numberOfConstraints; icons ++) {
OTConstraint constraint = & grammar -> constraints [grammar -> index [icons]];
MelderString_copy (& buffer, U"\t", ( icons == selectedConstraint ? U"♠︎ " : U" " ), U"@@", icons,
U"|", constraint -> name, U"@\t ", Melder_fixed (constraint -> ranking, 3),
U"\t ", Melder_fixed (constraint -> disharmony, 3),
U"\t ", Melder_fixed (constraint -> plasticity, 6)
);
HyperPage_listItem (this, buffer.string);
}
Graphics_setAtSignIsLink (g, FALSE);
drawTableau_grammar = grammar;
for (long icand = 1; icand <= grammar -> numberOfCandidates; icand ++) {
if (OTMulti_candidateMatches (grammar, icand, form1, form2)) {
tableauHeight += rowHeight;
}
}
drawTableau_form1 = form1;
drawTableau_form2 = form2;
drawTableau_constraintsAreDrawnVertically = d_constraintsAreDrawnVertically;
HyperPage_picture (this, 20, tableauHeight, drawTableau);
Graphics_setAtSignIsLink (g, TRUE);
}
开发者ID:psibre,项目名称:praat,代码行数:28,代码来源:OTMultiEditor.cpp
示例6: Melder_system
void Melder_system (const char32 *command) {
if (! command) command = U"";
#if defined (macintosh) || defined (UNIX)
if (system (Melder_peek32to8 (command)) != 0)
Melder_throw (U"System command failed.");
#elif defined (_WIN32)
STARTUPINFO siStartInfo;
PROCESS_INFORMATION piProcInfo;
char32 *comspec = Melder_getenv (U"COMSPEC"); // e.g. "C:\WINDOWS\COMMAND.COM" or "C:\WINNT\windows32\cmd.exe"
if (! comspec) {
comspec = Melder_getenv (U"ComSpec");
}
autoMelderString buffer;
if (comspec) {
MelderString_copy (& buffer, comspec);
} else {
OSVERSIONINFOEX osVersionInfo;
memset (& osVersionInfo, 0, sizeof (OSVERSIONINFOEX));
osVersionInfo. dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
if (! GetVersionEx ((OSVERSIONINFO *) & osVersionInfo)) {
osVersionInfo. dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
if (! GetVersionEx ((OSVERSIONINFO *) & osVersionInfo))
Melder_throw (U"System command cannot find system version.");
}
switch (osVersionInfo. dwPlatformId) {
case VER_PLATFORM_WIN32_NT: {
MelderString_copy (& buffer, U"cmd.exe");
} break; case VER_PLATFORM_WIN32_WINDOWS: {
MelderString_copy (& buffer, U"command.com");
} break; default: {
MelderString_copy (& buffer, U"command.com");
}
}
}
MelderString_append (& buffer, U" /c ", command);
memset (& siStartInfo, 0, sizeof (siStartInfo));
siStartInfo. cb = sizeof (siStartInfo);
if (! CreateProcess (nullptr, Melder_peek32toW (buffer.string), nullptr, nullptr, true, CREATE_NO_WINDOW, nullptr, nullptr, & siStartInfo, & piProcInfo))
Melder_throw (U"Cannot create subprocess.");
WaitForSingleObject (piProcInfo. hProcess, -1);
CloseHandle (piProcInfo. hProcess);
CloseHandle (piProcInfo. hThread);
#endif
}
开发者ID:nullpunktTUD,项目名称:praat,代码行数:44,代码来源:melder_sysenv.cpp
示例7: FFNet_createNameFromTopology
autostring32 FFNet_createNameFromTopology (FFNet me) {
autoMelderString name;
MelderString_copy (&name, my nUnitsInLayer[0]);
for (long i = 1; i <= my nLayers; i++) {
MelderString_appendCharacter (&name, U'-');
MelderString_append (&name, my nUnitsInLayer[i]);
}
autostring32 naam = Melder_dup (name.string);
return naam.transfer();
}
开发者ID:ffostertw,项目名称:praat,代码行数:10,代码来源:FFNet.cpp
示例8: Melder_system
void Melder_system (const wchar_t *command) {
#if defined (macintosh) || defined (UNIX)
if (system (Melder_peekWcsToUtf8 (command)) != 0)
Melder_throw ("System command failed.");
#elif defined (_WIN32)
STARTUPINFO siStartInfo;
PROCESS_INFORMATION piProcInfo;
wchar_t *comspec = Melder_getenv (L"COMSPEC"); // e.g. "C:\WINDOWS\COMMAND.COM" or "C:\WINNT\windows32\cmd.exe"
if (comspec == NULL) {
comspec = Melder_getenv (L"ComSpec");
}
MelderString buffer = { 0 };
if (comspec != NULL) {
MelderString_copy (& buffer, comspec);
} else {
OSVERSIONINFOEX osVersionInfo;
memset (& osVersionInfo, 0, sizeof (OSVERSIONINFOEX));
osVersionInfo. dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
if (! GetVersionEx ((OSVERSIONINFO *) & osVersionInfo)) {
osVersionInfo. dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
if (! GetVersionEx ((OSVERSIONINFO *) & osVersionInfo))
Melder_throw ("System command cannot find system version.");
}
switch (osVersionInfo. dwPlatformId) {
case VER_PLATFORM_WIN32_NT: {
MelderString_copy (& buffer, L"cmd.exe");
} break; case VER_PLATFORM_WIN32_WINDOWS: {
MelderString_copy (& buffer, L"command.com");
} break; default: {
MelderString_copy (& buffer, L"command.com");
}
}
}
MelderString_append (& buffer, L" /c ", command);
memset (& siStartInfo, 0, sizeof (siStartInfo));
siStartInfo. cb = sizeof (siStartInfo);
if (! CreateProcess (NULL, buffer.string, NULL, NULL, TRUE, 0, NULL, NULL, & siStartInfo, & piProcInfo))
Melder_throw ("Cannot create subprocess.");
WaitForSingleObject (piProcInfo. hProcess, -1);
CloseHandle (piProcInfo. hProcess);
CloseHandle (piProcInfo. hThread);
#endif
}
开发者ID:arizona-phonological-imaging-lab,项目名称:ultrapraat,代码行数:43,代码来源:melder_sysenv.cpp
示例9: Melder_pad
const char32 * Melder_pad (const char32 *string, int64 width) {
if (++ iPadBuffer == NUMBER_OF_BUFFERS) iPadBuffer = 0;
int64 length = str32len (string);
int64 tooShort = width - length;
if (tooShort <= 0) return string;
MelderString_copy (& thePadBuffers [iPadBuffer], string);
for (int64 i = 0; i < tooShort; i ++)
MelderString_appendCharacter (& thePadBuffers [iPadBuffer], U' ');
return thePadBuffers [iPadBuffer]. string;
}
开发者ID:READSEARCH,项目名称:praat,代码行数:10,代码来源:melder_ftoa.cpp
示例10: NativeMenuItem_setText
static void NativeMenuItem_setText (GuiObject me) {
int acc = my motiff.pushButton.acceleratorChar, modifiers = my motiff.pushButton.acceleratorModifiers;
#if win
static MelderString title = { 0 };
if (acc == 0) {
MelderString_copy (& title, _GuiWin_expandAmpersands (my name));
} else {
static const wchar_t *keyStrings [256] = {
0, L"<-", L"->", L"Up", L"Down", L"PAUSE", L"Del", L"Ins", L"Backspace", L"Tab", L"LineFeed", L"Home", L"End", L"Enter", L"PageUp", L"PageDown",
L"Esc", L"F1", L"F2", L"F3", L"F4", L"F5", L"F6", L"F7", L"F8", L"F9", L"F10", L"F11", L"F12", 0, 0, 0,
L"Space", L"!", L"\"", L"#", L"$", L"%", L"&", L"\'", L"(", L")", L"*", L"+", L",", L"-", L".", L"/",
L"0", L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9", L":", L";", L"<", L"=", L">", L"?",
L"@", L"A", L"B", L"C", L"D", L"E", L"F", L"G", L"H", L"I", L"J", L"K", L"L", L"M", L"N", L"O",
L"P", L"Q", L"R", L"S", L"T", L"U", L"V", L"W", L"X", L"Y", L"Z", L"[", L"\\", L"]", L"^", L"_",
L"`", L"a", L"b", L"c", L"d", L"e", L"f", L"g", L"h", L"i", L"j", L"k", L"l", L"m", L"n", L"o",
L"p", L"q", L"r", L"s", L"t", L"u", L"v", L"w", L"x", L"y", L"z", L"{", L"|", L"}", L"~", L"Del",
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, L"[", L"]", L",", L"?", L".", L"\\",
L";", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, L"-", L"`", L"=", L"\'", 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
const wchar_t *keyString = keyStrings [acc] ? keyStrings [acc] : L"???";
MelderString_empty (& title);
MelderString_append (& title, _GuiWin_expandAmpersands (my name), L"\t",
modifiers & _motif_COMMAND_MASK ? L"Ctrl-" : NULL,
modifiers & _motif_OPTION_MASK ? L"Alt-" : NULL,
modifiers & _motif_SHIFT_MASK ? L"Shift-" : NULL, keyString);
}
ModifyMenu (my nat.entry.handle, my nat.entry.id, MF_BYCOMMAND | MF_STRING, my nat.entry.id, title.string);
#elif mac
static int theGlyphs [1+31] = { 0,
kMenuLeftArrowDashedGlyph, kMenuRightArrowDashedGlyph, kMenuUpArrowDashedGlyph, kMenuDownwardArrowDashedGlyph, 0,
kMenuDeleteRightGlyph, 0, kMenuDeleteLeftGlyph, kMenuTabRightGlyph, 0,
0, 0, kMenuReturnGlyph, kMenuPageUpGlyph, kMenuPageDownGlyph,
kMenuEscapeGlyph, kMenuF1Glyph, kMenuF2Glyph, kMenuF3Glyph, kMenuF4Glyph,
kMenuF5Glyph, kMenuF6Glyph, kMenuF7Glyph, kMenuF8Glyph, kMenuF9Glyph,
kMenuF10Glyph, kMenuF11Glyph, kMenuF12Glyph, 0, 0,
0 };
SetMenuItemTextWithCFString (my nat.entry.handle, my nat.entry.item, (CFStringRef) Melder_peekWcsToCfstring (my name));
if (acc > 32) {
SetItemCmd (my nat.entry.handle, my nat.entry.item, acc);
} else {
Melder_assert (acc > 0 && acc < 32);
SetItemCmd (my nat.entry.handle, my nat.entry.item, ' '); /* Funny that this should be needed. */
SetMenuItemKeyGlyph (my nat.entry.handle, my nat.entry.item, theGlyphs [acc]);
}
SetMenuItemModifiers (my nat.entry.handle, my nat.entry.item,
( modifiers & _motif_OPTION_MASK ? kMenuOptionModifier : 0 ) +
( modifiers & _motif_SHIFT_MASK ? kMenuShiftModifier : 0 ) +
( modifiers & _motif_COMMAND_MASK ? 0 : kMenuNoCommandModifier ));
#endif
}
开发者ID:danrasband,项目名称:libpraat,代码行数:55,代码来源:GuiMenuItem.cpp
示例11: v_nameChanged
void structTextEditor :: v_nameChanged () {
if (v_fileBased ()) {
bool dirtinessAlreadyShown = GuiWindow_setDirty (our d_windowForm, our dirty);
static MelderString windowTitle { 0 };
if (our name [0] == U'\0') {
MelderString_copy (& windowTitle, U"(untitled");
if (dirty && ! dirtinessAlreadyShown)
MelderString_append (& windowTitle, U", modified");
MelderString_append (& windowTitle, U")");
} else {
MelderString_copy (& windowTitle, U"File ", MelderFile_messageName (& our file));
if (dirty && ! dirtinessAlreadyShown)
MelderString_append (& windowTitle, U" (modified)");
}
GuiShell_setTitle (our d_windowForm, windowTitle.string);
//MelderString_copy (& windowTitle, our dirty && ! dirtinessAlreadyShown ? U"*" : U"", our name [0] == U'\0' ? U"(untitled)" : MelderFile_name (& our file));
} else {
TextEditor_Parent :: v_nameChanged ();
}
}
开发者ID:ffostertw,项目名称:praat,代码行数:20,代码来源:TextEditor.cpp
示例12: v_nameChanged
void structScriptEditor :: v_nameChanged () {
bool dirtinessAlreadyShown = d_windowForm -> f_setDirty (dirty);
static MelderString buffer = { 0 };
MelderString_copy (& buffer, name [0] ? L"Script" : L"untitled script");
if (editorClass)
MelderString_append (& buffer, L" [", environmentName, L"]");
if (name [0])
MelderString_append (& buffer, L" ", MelderFile_messageName (& file));
if (dirty && ! dirtinessAlreadyShown)
MelderString_append (& buffer, L" (modified)");
d_windowForm -> f_setTitle (buffer.string);
}
开发者ID:danrasband,项目名称:libpraat,代码行数:12,代码来源:ScriptEditor.cpp
示例13: v_nameChanged
void structScriptEditor :: v_nameChanged () {
bool dirtinessAlreadyShown = GuiWindow_setDirty (d_windowForm, dirty);
static MelderString buffer { 0 };
MelderString_copy (& buffer, name [0] ? U"Script" : U"untitled script");
if (editorClass)
MelderString_append (& buffer, U" [", environmentName, U"]");
if (name [0])
MelderString_append (& buffer, U" ", MelderFile_messageName (& file));
if (dirty && ! dirtinessAlreadyShown)
MelderString_append (& buffer, U" (modified)");
GuiShell_setTitle (d_windowForm, buffer.string);
}
开发者ID:eginhard,项目名称:praat,代码行数:12,代码来源:ScriptEditor.cpp
示例14: menu_cb_writeOneToHtmlFile
static void menu_cb_writeOneToHtmlFile (Manual me, EDITOR_ARGS_FORM) {
EDITOR_FORM_WRITE (U"Save as HTML file", nullptr)
ManPages manPages = (ManPages) my data;
autoMelderString buffer;
MelderString_copy (& buffer, manPages -> pages.at [my path] -> title);
char32 *p = buffer.string;
while (*p) { if (! isalnum ((int) *p) && *p != U'_') *p = U'_'; p ++; }
MelderString_append (& buffer, U".html");
Melder_sprint (defaultName,300, buffer.string);
EDITOR_DO_WRITE
ManPages_writeOneToHtmlFile ((ManPages) my data, my path, file);
EDITOR_END
}
开发者ID:DsRQuicke,项目名称:praat,代码行数:13,代码来源:Manual.cpp
示例15: Melder_padOrTruncate
const char32 * Melder_padOrTruncate (const char32 *string, int64 width) {
if (++ iPadBuffer == NUMBER_OF_BUFFERS) iPadBuffer = 0;
int64 length = str32len (string);
int64 tooLong = length - width;
if (tooLong == 0) return string;
if (tooLong < 0) {
int64 tooShort = - tooLong;
MelderString_copy (& thePadBuffers [iPadBuffer], string);
for (int64 i = 0; i < tooShort; i ++)
MelderString_appendCharacter (& thePadBuffers [iPadBuffer], U' ');
} else {
MelderString_ncopy (& thePadBuffers [iPadBuffer], string, width);
}
return thePadBuffers [iPadBuffer]. string;
}
开发者ID:READSEARCH,项目名称:praat,代码行数:15,代码来源:melder_ftoa.cpp
示例16: searchToken
static double searchToken (ManPages me, long ipage, wchar_t *token) {
double goodness = 0.0;
ManPage page = (ManPage) my pages -> item [ipage];
struct structManPage_Paragraph *par = & page -> paragraphs [0];
if (! token [0]) return 1.0;
/*
* Try to find a match in the title, case insensitively.
*/
static MelderString buffer = { 0 };
MelderString_copy (& buffer, page -> title);
for (wchar_t *p = & buffer.string [0]; *p != '\0'; p ++) *p = tolower (*p);
if (wcsstr (buffer.string, token)) {
goodness += 300.0; /* Lots of points for a match in the title! */
if (wcsequ (buffer.string, token))
goodness += 10000.0; /* Even more points for an exact match! */
}
/*
* Try to find a match in the paragraphs, case-insensitively.
*/
while (par -> type) {
if (par -> text) {
wchar_t *ptoken;
MelderString_copy (& buffer, par -> text);
for (wchar_t *p = & buffer.string [0]; *p != '\0'; p ++) *p = tolower (*p);
ptoken = wcsstr (buffer.string, token);
if (ptoken) {
goodness += 10.0; /* Ten points for every paragraph with a match! */
if (wcsstr (ptoken + wcslen (token), token)) {
goodness += 1.0; /* One point for every second occurrence in a paragraph! */
}
}
}
par ++;
}
return goodness;
}
开发者ID:georgiee,项目名称:lip-sync-lpc,代码行数:36,代码来源:Manual.cpp
示例17: searchToken
static double searchToken (ManPages me, long ipage, char32 *token) {
double goodness = 0.0;
ManPage page = my pages.at [ipage];
struct structManPage_Paragraph *par = & page -> paragraphs [0];
if (! token [0]) return 1.0;
/*
* Try to find a match in the title, case insensitively.
*/
static MelderString buffer { 0 };
MelderString_copy (& buffer, page -> title);
for (char32 *p = & buffer.string [0]; *p != U'\0'; p ++) *p = towlower ((int) *p);
if (str32str (buffer.string, token)) {
goodness += 300.0; // lots of points for a match in the title!
if (str32equ (buffer.string, token))
goodness += 10000.0; // even more points for an exact match!
}
/*
* Try to find a match in the paragraphs, case-insensitively.
*/
while (par -> type) {
if (par -> text) {
char32 *ptoken;
MelderString_copy (& buffer, par -> text);
for (char32 *p = & buffer.string [0]; *p != '\0'; p ++) *p = towlower ((int) *p);
ptoken = str32str (buffer.string, token);
if (ptoken) {
goodness += 10.0; // ten points for every paragraph with a match!
if (str32str (ptoken + str32len (token), token)) {
goodness += 1.0; // one point for every second occurrence in a paragraph!
}
}
}
par ++;
}
return goodness;
}
开发者ID:DsRQuicke,项目名称:praat,代码行数:36,代码来源:Manual.cpp
示例18: EEG_setChannelNames_selected
static void EEG_setChannelNames_selected (EEG me, const char32 *precursor, long *channelNumbers, long numberOfChannels) {
autoMelderString name;
const char32 *zero = U"0";
for (long i = 1; i <= numberOfChannels; i++) {
MelderString_copy (&name, precursor);
if (my numberOfChannels > 100) {
if (i < 10) {
MelderString_append (&name, zero);
}
if (i < 100) {
MelderString_append (&name, zero);
}
} else if (i < 10) {
MelderString_append (&name, zero);
}
MelderString_append (&name, i);
EEG_setChannelName (me, channelNumbers[i], name.string);
}
}
开发者ID:psibre,项目名称:praat,代码行数:19,代码来源:EEG_extensions.cpp
示例19: search
static void search (Manual me, const char32 *query) {
ManPages manPages = (ManPages) my data;
long numberOfPages = manPages -> pages.size;
static MelderString searchText { 0 };
MelderString_copy (& searchText, query);
for (char32 *p = & searchText.string [0]; *p != U'\0'; p ++) {
if (*p == U'\n') *p = U' ';
*p = towlower ((int) *p);
}
if (! goodnessOfMatch)
goodnessOfMatch = NUMvector <double> (1, numberOfPages);
for (long ipage = 1; ipage <= numberOfPages; ipage ++) {
char32 *token = searchText.string;
goodnessOfMatch [ipage] = 1.0;
for (;;) {
char32 *space = str32chr (token, U' ');
if (space) *space = U'\0';
goodnessOfMatch [ipage] *= searchToken (manPages, ipage, token);
if (! space) break;
*space = U' '; // restore
token = space + 1;
}
}
/*
* Find the 20 best matches.
*/
my numberOfMatches = 0;
for (long imatch = 1; imatch <= 20; imatch ++) {
long imax = 0;
double max = 0.0;
for (long ipage = 1; ipage <= numberOfPages; ipage ++) {
if (goodnessOfMatch [ipage] > max) {
max = goodnessOfMatch [ipage];
imax = ipage;
}
}
if (! imax) break;
my matches [++ my numberOfMatches] = imax;
goodnessOfMatch [imax] = 0.0; // skip next time
}
HyperPage_goToPage_i (me, SEARCH_PAGE);
}
开发者ID:DsRQuicke,项目名称:praat,代码行数:42,代码来源:Manual.cpp
示例20: FileInMemorySet_showAsCode
void FileInMemorySet_showAsCode (FileInMemorySet me, const char32 *name, long numberOfBytesPerLine) {
autoMelderString one_fim;
MelderInfo_writeLine (U"#include \"Collection.h\"");
MelderInfo_writeLine (U"#include \"FileInMemory.h\"");
MelderInfo_writeLine (U"#include \"melder.h\"\n");
MelderInfo_writeLine (U"autoFilesInMemory create_", name, U" () {");
MelderInfo_writeLine (U"\ttry {");
MelderInfo_writeLine (U"\t\tautoFilesInMemory me = FilesInMemory_create ();");
for (long ifile = 1; ifile <= my size; ifile ++) {
FileInMemory fim = my at [ifile];
MelderString_copy (& one_fim, name, ifile);
FileInMemory_showAsCode (fim, one_fim.string, numberOfBytesPerLine);
MelderInfo_writeLine (U"\t\tCollection_addItem_move (me.peek(), ", one_fim.string, U".move());\n");
}
MelderInfo_writeLine (U"\t\treturn me;");
MelderInfo_writeLine (U"\t} catch (MelderError) {");
MelderInfo_writeLine (U"\t\tMelder_throw (U\"FileInMemorySet not created.\");");
MelderInfo_writeLine (U"\t}");
MelderInfo_writeLine (U"}\n\n");
}
开发者ID:DsRQuicke,项目名称:praat,代码行数:20,代码来源:FileInMemory.cpp
注:本文中的MelderString_copy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论