本文整理汇总了C++中JString::Read方法的典型用法代码示例。如果您正苦于以下问题:C++ JString::Read方法的具体用法?C++ JString::Read怎么用?C++ JString::Read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JString
的用法示例。
在下文中一共展示了JString::Read方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
GMMIMEParser::ParseByType
(
std::istream& input,
const GMIMEHeader& header,
const JIndex isEnd
)
{
if (header.GetType() == kMessageType &&
header.GetSubType() == "rfc822")
{
Parse(input, isEnd, kJTrue);
}
else if (TextIsReadable(header))
{
JString data;
JIndex current = JTellg(input);
data.Read(input, isEnd - current + 1);
WriteTextString(&data, header);
}
else if (header.GetType() == kMultipartType)
{
if (header.GetSubType() == kMixedType ||
header.GetSubType() == kRelatedType)
{
ParseMixed(input, header);
}
else if (header.GetSubType() == kAlternateType)
{
ParseAlternate(input, header);
}
else
{
ParseMixed(input, header);
}
}
else
{
JString data;
JIndex current = JTellg(input);
data.Read(input, isEnd - current + 1);
WriteAttachment(data, header);
}
}
示例2: input
JBoolean
JFSBindingList::GetBinding
(
const JCharacter* origFileName,
const JFSBinding** binding
)
{
// ignore # and ~ on end
JString fileName = origFileName;
CleanFileName(&fileName);
// read content
JString content;
ifstream input(origFileName);
content.Read(input, kContentLength);
input.close();
// scan bindings for match -- check content types first
const JSize count = GetElementCount();
for (JIndex j=0; j<=1; j++)
{
const JBoolean isContent = JNegate(j);
for (JIndex i=1; i<=count; i++)
{
*binding = GetBinding(i);
if ((**binding).IsContentBinding() == isContent &&
(**binding).Match(fileName, content))
{
return kJTrue;
}
}
}
if (itsUseDefaultFlag && itsUserDefault != NULL)
{
*binding = itsUserDefault;
return kJTrue;
}
if (itsUseDefaultFlag && itsSystemDefault != NULL)
{
*binding = itsSystemDefault;
return kJTrue;
}
*binding = NULL;
return kJFalse;
}
示例3: JTellg
void
GMMIMEParser::ParseAlternate
(
std::istream& input,
const GMIMEHeader& header
)
{
JString boundary = "-" + header.GetBoundary();
JString data;
JString junk;
// slurp the initial empty part
JIndex bstart, bend;
ReadUntilBoundary(input, boundary, &bstart, &bend);
JIndex current = JTellg(input);
data.Read(input, bend - current + 1);
JString text;
JString charset;
JString subType;
GMIMEHeader shownHeader;
while (1)
{
GMIMEHeader child;
ParseMIMEHeader(input, &child);
if (child.GetSubType() != kPlainType && child.GetSubType() != kHTMLType)
{
text = data;
while (!ReadUntilBoundary(input, boundary, &bstart, &bend))
{
// slurp up the rest, because it is useless to us.
current = JTellg(input);
data.Read(input, bend - current + 1);
}
current = JTellg(input);
data.Read(input, bend - current + 1);
data.Clear();
break;
}
else
{
shownHeader = child;
}
// when the following function returns true, it has found the
// last boundary
data.Clear();
JBoolean end = ReadUntilBoundary(input, boundary, &bstart, &bend);
current = JTellg(input);
data.Read(input, bstart - current);
current = JTellg(input);
junk.Read(input, bend - current + 1);
if (end)
{
text = data;
data.Clear();
break;
}
}
WriteTextString(&text, shownHeader);
if (itsTextInfo != NULL)
{
itsTextInfo->ForceUpdate();
}
if (itsAttachInfo != NULL)
{
itsAttachInfo->ForceUpdate();
}
}
示例4: os
void
GMMIMEParser::ParseMixed
(
std::istream& input,
const GMIMEHeader& header
)
{
JString boundary = "-" + header.GetBoundary();
JString endBoundary = boundary + "--";
// slurp the initial empty part
JIndex bstart, bend;
ReadUntilBoundary(input, boundary, &bstart, &bend);
JIndex current = JTellg(input);
JString data;
data.Read(input, bend - current + 1);
while (1)
{
GMIMEHeader child;
ParseMIMEHeader(input, &child);
// when the following function returns true, it has found the
// last boundary
data.Clear();
JBoolean end;
if (child.GetEncoding() == kBase64Encoding)
{
JString filename = child.GetFileName();
if (filename.IsEmpty())
{
JCreateTempFile(itsAttachDir, NULL, &filename);
}
else
{
filename = JCombinePathAndName(itsAttachDir, filename);
}
if (!filename.IsEmpty())
{
AdjustAttachmentName(child, &filename);
std::ofstream os(filename);
JDecodeBase64(input, os);
end = ReadUntilBoundary(input, boundary, &bstart, &bend);
// JBoolean found;
// JString line;
// while (line.IsEmpty() && !input.fail())
// {
// line = JReadLine(input, &found);
// }
// JString endBoundary = boundary + "--";
// if (line.Contains(endBoundary))
// {
// end = kJTrue;
// }
}
}
else if ((child.GetType() != kMultipartType) &&
(!child.GetFileName().IsEmpty()))
{
JIndex startI = JTellg(input);
JIndex findex = startI;
if (itsData->LocateNextSubstring(boundary, &findex))
{
const JCharacter* c = itsData->GetCString() + startI;
JString filename = child.GetFileName();
if (filename.IsEmpty())
{
JCreateTempFile(itsAttachDir, NULL, &filename);
}
else
{
filename = JCombinePathAndName(itsAttachDir, filename);
}
if (!filename.IsEmpty())
{
AdjustAttachmentName(child, &filename);
std::ofstream os(filename);
JSeekg(input, findex - 1);
if (child.GetEncoding() == kQPEncoding)
{
JString data = itsData->GetSubstring(startI, findex - 3);
ParseQuotedPrintable(&data);
data.Print(os);
}
else
{
os.write(c, findex - startI - 3);
}
JBoolean found;
JString line = JReadLine(input, &found);
if (line.BeginsWith(endBoundary))
{
end = kJTrue;
}
}
}
}
else
{
end = ReadUntilBoundary(input, boundary, &bstart, &bend);
//.........这里部分代码省略.........