本文整理汇总了C++中JString函数的典型用法代码示例。如果您正苦于以下问题:C++ JString函数的具体用法?C++ JString怎么用?C++ JString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了JString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
GLFitParameterTable::GetValueString
(
JString* text
)
{
const JSize count = itsNameList->GetElementCount();
for (JIndex i = 1; i <= count; i++)
{
JString* str = itsNameList->NthElement(i);
JFloat start = itsStartValues->GetElement(i);
JFloat fit = itsFitValues->GetElement(i);
JFloat error = itsErrorValues->GetElement(i);
*text += *str + "\n\t";
if (itsHasStartValues)
{
*text += "Start value: " + JString(start, JString::kPrecisionAsNeeded, JString::kStandardExponent, 0, 6);
text->Append("\n\t");
}
*text += "Fit value: " + JString(fit, JString::kPrecisionAsNeeded, JString::kStandardExponent, 0, 6);
text->Append("\n\t");
*text += "Error value: " + JString(error, JString::kPrecisionAsNeeded, JString::kStandardExponent, 0, 6);
text->AppendCharacter('\n');
}
}
示例2: SetHasParameterErrors
void
JPlotLinearFit::JPlotLinearFitX
(
J2DPlotWidget* plot,
JPlotDataBase* fitData,
const JBoolean xlog,
const JBoolean ylog
)
{
SetHasParameterErrors(kJTrue);
SetParameterCount(2);
SetHasGoodnessOfFit(kJTrue);
itsXIsLog = xlog;
itsYIsLog = ylog;
if (!xlog && !ylog)
{
itsFunctionName = jnew JString("y = a+bx");
}
else if (!xlog && ylog)
{
itsFunctionName = jnew JString("y = a Exp(bx)");
}
itsRealCount = 0;
GenerateFit();
GenerateDiffData();
if (itsYIsLog && !itsXIsLog)
{
AdjustDiffData();
}
}
示例3: JString
JString
JPrintFileSize
(
const JSize size
)
{
if (size < 8192)
{
return JString(size, 0);
}
else if (size < 1048576)
{
return JString(size/1024.0, 0) + "K";
}
else if (size < 134217728)
{
return JString(size/1048576.0, 1) + "M";
}
else if (size < 1073741824)
{
return JString(size/1048576.0, 0) + "M";
}
else
{
return JString(size/1073741824.0, 1) + "G";
}
}
示例4: GetFontManager
void
FitParmsTable::Append
(
const JCharacter* col1,
const JCharacter* col2
)
{
const JFontManager* fm = GetFontManager();
JSize lineHeight = fm->GetDefaultFont().GetLineHeight();
AppendRows(1, lineHeight + 2);
JString* str = jnew JString(col1);
itsCol1->Append(str);
JSize col1Width = GetColWidth(1);
JSize strWidth = fm->GetDefaultFont().GetStringWidth(*str);
if (strWidth + 10 > col1Width)
{
SetColWidth(1, strWidth + 10);
}
str = jnew JString(col2);
itsCol2->Append(str);
JSize col2Width = GetColWidth(2);
strWidth = fm->GetDefaultFont().GetStringWidth(*str);
if (strWidth + 10 > col2Width)
{
SetColWidth(2, strWidth + 10);
}
TableRefresh();
}
示例5: JString
JString
JStopWatch::FormatTimeInterval
(
const JFloat time
)
{
JString timeString;
if (time < 60.0) // less than 1 min
{
timeString = JString(time) + " seconds";
}
else if (time < 3600.0) // less than 1 hour
{
timeString = JString(time/60.0) + " minutes";
}
else if (time < 86400.0) // less than 1 day
{
timeString = JString(time/3600.0) + " hours";
}
else
{
timeString = JString(time/86400.0) + " days";
}
return timeString;
}
示例6: GetData
JString
GPrefsMgr::GetSMTPUser()
{
if (IDValid(kSMTPUserID))
{
std::string data;
const JBoolean ok = GetData(kSMTPUserID, &data);
assert( ok );
std::istringstream dataStream(data);
JString user;
dataStream >> user;
if (!user.IsEmpty())
{
return user;
}
}
JCharacter* name = getenv("LOGNAME");
if (name == NULL)
{
return JString();
}
return JString(name);
}
示例7: JString
JString JTNGObj::outputTag(int n) {
if (n < 2) {
char* tag[] = { "Sync", "Clock"};
return JString(tag[n])+NBTag();
}
return JString("ch-")+JInteger::toJString(n-1)+NBTag();
}
示例8: if
void
GLPolyFitDialog::Receive
(
JBroadcaster* sender,
const Message& message
)
{
if (sender == itsHelpButton && message.Is(JXButton::kPushed))
{
}
else if (message.Is(JXCheckbox::kPushed))
{
JString fStr;
JBoolean started = kJFalse;
const JSize count = 10;
for (JIndex i = 1; i <= count; i++)
{
if (itsCB[i-1]->IsChecked())
{
if (started)
{
fStr += " + ";
}
else
{
started = kJTrue;
}
JString parm = "a" + JString(i - 1, JString::kBase10);
JString xTerm = " * x";
if (i > 2)
{
xTerm += "^" + JString(i - 1, JString::kBase10);
}
fStr += parm;
if (i > 1)
{
fStr += xTerm;
}
}
}
if (fStr.IsEmpty())
{
itsFn->Hide();
}
else
{
itsFn->Show();
JFunction* f;
if (JParseFunction(fStr, itsVarList, &f))
{
itsFn->SetFunction(itsVarList, f);
}
}
}
else
{
JXDialogDirector::Receive(sender, message);
}
}
示例9: JString
JString JTNG4Obj::outputTag(int n) {
if (n < OUT_COM) {
char* tag[] = { "Sync", "Clock"};
return JString(tag[n])+NBTag();
} if (n == OUT_COM) {
return "COM";
}
return JString("ch-")+JInteger::toJString(n-2)+NBTag();
}
示例10: JString
void JUploadPlugin::putDownloadLink(JNIEnv* env, jobject jthis, jstring urlDownload, jstring killLink)
{
JUploadPlugin* This = static_cast<JUploadPlugin*>(getCObject(jthis));
QString klink, dlink = JString(urlDownload).str();
if (killLink)
klink = JString(killLink).str();
static_cast<JavaUpload*>(This->m_transfer)->putDownloadLink(dlink, klink);
}
示例11: setNValue
boolean J1DMObj::updateProperty(JProperty& prop) {
if (JNBitsObj::updateProperty(prop)) return true;
if (prop.getName() == JString("vx")) {
setNValue(0, ((JIntegerProperty*)&prop)->value);
return true;
} else if (prop.getName() == JString("vy")) {
setNValue(1, ((JIntegerProperty*)&prop)->value);
return true;
}
return false;
}
示例12: setDelay
boolean JTimerObj::updateProperty(JProperty& prop) {
if (JANDObj::updateProperty(prop)) return true;
if (prop.getName() == JString("delay")) {
setDelay(((JIntegerProperty*)&prop)->value);
return true;
} else if (prop.getName() == JString("priority")) {
priority = ((JIntegerListProperty*)&prop)->value;
return true;
}
return false;
}
示例13: sizeof
JString JBlockTcpSocket::GetLocalIP()
{
sockaddr_in addr;
int len = sizeof(sockaddr_in);
if( ::getsockname(m_socket, LPSOCKADDR(&addr), &len) != SOCKET_ERROR ){
TCHAR outIP[32];
unsigned char* ip = reinterpret_cast<unsigned char*>(&addr.sin_addr);
_stprintf_s(outIP, 32, _T("%d.%d.%d.%d"), ip[0], ip[1], ip[2], ip[3]);
return JString(outIP);
}
return JString();
}
示例14: setLabel
boolean JBtnObj::updateProperty(JProperty& prop) {
if (JNBitsObj::updateProperty(prop)) return true;
if (prop.getName() == JString("label")) {
setLabel(((JStringProperty*)&prop)->value);
return true;
} else if (prop.getName() == JString("type")) {
type = ((JIntegerListProperty*)&prop)->value;
repaint();
return true;
}
return false;
}
示例15: broadcast
boolean JDelaySustainObj::updateProperty(JProperty& prop) {
if (JAddObj::updateProperty(prop)) return true;
if (prop.getName() == JString("delay")) {
delay = ((JIntegerProperty*)&prop)->value;
broadcast(OUT_DELAY);
return true;
} else if (prop.getName() == JString("sustain")) {
sustain = ((JIntegerProperty*)&prop)->value;
broadcast(OUT_SUSTAIN);
return true;
}
return false;
}