本文整理汇总了C++中QCString类的典型用法代码示例。如果您正苦于以下问题:C++ QCString类的具体用法?C++ QCString怎么用?C++ QCString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QCString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: remove_throw
void UmlOperation::set_cpp(const char * return_form_or_inherit,
const char * params, QCString body,
bool inlinep, const char * if_def,
const char * end_if) {
if (*return_form_or_inherit == ':') {
// inherit
if (inlinep) {
QCString s = remove_throw(CppSettings::operationDecl());
int index = s.find("${)}");
s.resize(index + 5);
s.insert(index, params);
s.append(" ");
s.append(return_form_or_inherit);
if (!body.isEmpty()) {
s.append(" {\n ");
s.append(body);
s.append("}\n");
}
else
s.append(" {\n}\n");
conditional(s, if_def, end_if);
set_CppDecl(s);
set_CppDef("");
}
else {
QCString s = remove_throw(CppSettings::operationDecl());
int index = s.find("${)}");
s.resize(index + 5);
s.insert(index, params);
s.append(";");
conditional(s, if_def, end_if);
set_CppDecl(s);
s = remove_throw(CppSettings::operationDef());
index = s.find("${)}");
s.resize(index + 5);
s.insert(index, params);
s.append(" ");
s.append(return_form_or_inherit);
if (!body.isEmpty()) {
s.append(" {\n ");
s.append(body);
s.append("}\n");
}
else
s.append(" {\n}\n");
conditional(s, if_def, end_if);
set_CppDef(s);
}
}
else {
// return
if (inlinep) {
QCString s = remove_throw(CppSettings::operationDecl());
int index = s.find("${type}");
s.replace(index, 7, return_form_or_inherit);
s.insert(s.find("${)}", index), params);
s.resize(s.findRev(";") + 1);
if (!body.isEmpty()) {
s.append(" {\n ");
s.append(body);
s.append("}\n");
}
else
s.append(" {\n}\n");
conditional(s, if_def, end_if);
set_CppDecl(s);
set_CppDef("");
}
else {
QCString s = remove_throw(CppSettings::operationDecl());
int index = s.find("${type}");
s.replace(index, 7, return_form_or_inherit);
s.insert(s.find("${)}", index), params);
conditional(s, if_def, end_if);
set_CppDecl(s);
s = remove_throw(CppSettings::operationDef());
index = s.find("${type}");
s.replace(index, 7, return_form_or_inherit);
s.insert(s.find("${)}", index), params);
conditional(s, if_def, end_if);
set_CppDef(s);
set_CppBody(body);
}
}
}
示例2: readCodeFragment
/*! Reads a fragment of code from file \a fileName starting at
* line \a startLine and ending at line \a endLine (inclusive). The fragment is
* stored in \a result. If FALSE is returned the code fragment could not be
* found.
*
* The file is scanned for a opening bracket ('{') from \a startLine onward
* The line actually containing the bracket is returned via startLine.
* The file is scanned for a closing bracket ('}') from \a endLine backward.
* The line actually containing the bracket is returned via endLine.
* Note that for VHDL code the bracket search is not done.
*/
bool readCodeFragment(const char *fileName,
int &startLine,int &endLine,QCString &result)
{
static bool filterSourceFiles = Config_getBool("FILTER_SOURCE_FILES");
static int tabSize = Config_getInt("TAB_SIZE");
//printf("readCodeFragment(%s,%d,%d)\n",fileName,startLine,endLine);
if (fileName==0 || fileName[0]==0) return FALSE; // not a valid file name
QCString filter = getFileFilter(fileName,TRUE);
FILE *f=0;
bool usePipe = !filter.isEmpty() && filterSourceFiles;
SrcLangExt lang = getLanguageFromFileName(fileName);
if (!usePipe) // no filter given or wanted
{
f = portable_fopen(fileName,"r");
}
else // use filter
{
QCString cmd=filter+" \""+fileName+"\"";
Debug::print(Debug::ExtCmd,0,"Executing popen(`%s`)\n",cmd.data());
f = portable_popen(cmd,"r");
}
bool found = lang==SrcLangExt_VHDL ||
lang==SrcLangExt_Tcl ||
lang==SrcLangExt_Python ||
lang==SrcLangExt_Fortran;
// for VHDL, TCL, Python, and Fortran no bracket search is possible
if (f)
{
int c=0;
int col=0;
int lineNr=1;
// skip until the startLine has reached
while (lineNr<startLine && !feof(f))
{
while ((c=fgetc(f))!='\n' && c!=EOF) /* skip */;
lineNr++;
if (found && c == '\n') c = '\0';
}
if (!feof(f))
{
// skip until the opening bracket or lonely : is found
char cn=0;
while (lineNr<=endLine && !feof(f) && !found)
{
int pc=0;
while ((c=fgetc(f))!='{' && c!=':' && c!=EOF) // } so vi matching brackets has no problem
{
//printf("parsing char `%c'\n",c);
if (c=='\n')
{
lineNr++,col=0;
}
else if (c=='\t')
{
col+=tabSize - (col%tabSize);
}
else if (pc=='/' && c=='/') // skip single line comment
{
while ((c=fgetc(f))!='\n' && c!=EOF) pc=c;
if (c=='\n') lineNr++,col=0;
}
else if (pc=='/' && c=='*') // skip C style comment
{
while (((c=fgetc(f))!='/' || pc!='*') && c!=EOF)
{
if (c=='\n') lineNr++,col=0;
pc=c;
}
}
else
{
col++;
}
pc = c;
}
if (c==':')
{
cn=fgetc(f);
if (cn!=':') found=TRUE;
}
else if (c=='{') // } so vi matching brackets has no problem
{
found=TRUE;
}
}
//printf(" -> readCodeFragment(%s,%d,%d) lineNr=%d\n",fileName,startLine,endLine,lineNr);
if (found)
{
// For code with more than one line,
//.........这里部分代码省略.........
示例3: tlv
//.........这里部分代码省略.........
m_reconnect = NO_RECONNECT;
errorCode = AuthError;
break;
case ICQ_LOGIN_ERRxNOT_EXISTS1:
case ICQ_LOGIN_ERRxNOT_EXISTS2:
errString = I18N_NOOP("Non-existant UIN");
m_reconnect = NO_RECONNECT;
errorCode = AuthError;
break;
case ICQ_LOGIN_ERRxBAD_LOGIN:
errString = I18N_NOOP("Bad login procedure");
m_reconnect = NO_RECONNECT;
break;
case ICQ_LOGIN_ERRxUNAVAILABLE1:
case ICQ_LOGIN_ERRxUNAVAILABLE2:
case ICQ_LOGIN_ERRxUNAVAILABLE3:
case ICQ_LOGIN_ERRxUNAVAILABLE4:
case ICQ_LOGIN_ERRxUNAVAILABLE5:
case ICQ_LOGIN_ERRxUNAVAILABLE6:
case ICQ_LOGIN_ERRxUNAVAILABLE7:
case ICQ_LOGIN_ERRxUNAVAILABLE8:
errString = I18N_NOOP("Service temporarly unavailable");
m_reconnect = NO_RECONNECT;
break;
case ICQ_LOGIN_ERRxINVALID_ID:
errString = I18N_NOOP("Invalid SecureID");
m_reconnect = NO_RECONNECT;
break;
case ICQ_LOGIN_ERRxTOO_YOUNG:
errString = I18N_NOOP("Too young!");
m_reconnect = NO_RECONNECT;
break;
case ICQ_LOGIN_ERRxSUSPENDED1:
errString = I18N_NOOP("UIN was suspended");
m_reconnect = NO_RECONNECT;
break;
case ICQ_LOGIN_ERRxCANT_REGISTER:
errString = I18N_NOOP("Can't login to ICQ network - Please try again later");
m_reconnect = NO_RECONNECT;
break;
case 0:
break;
default:
errString = "Unknown error ";
errString += QString::number(err);
}
if (err){
log(L_ERROR, "%s", static_cast<const char *>(errString.local8Bit()));
socket()->error_state(errString, errorCode);
flap(ICQ_CHNxCLOSE);
sendPacket(true);
return;
}
}
tlv_error = tlv(9);
if (tlv_error){
QString errString;
unsigned short err = *tlv_error;
switch (err){
case 0x1:{
errString = I18N_NOOP("Your UIN is being used from another location");
m_reconnect = NO_RECONNECT;
break;
}
case 0:
break;
default:
errString = "Unknown run-time error ";
errString += QString::number(err);
}
if (err){
log(L_ERROR, "%s", static_cast<const char *>(errString.local8Bit()));
socket()->error_state(errString);
return;
}
}
flap(ICQ_CHNxCLOSE);
sendPacket(true);
Tlv *tlv_host = tlv(5);
Tlv *tlv_cookie = tlv(6);
if ((tlv_host == NULL) || (tlv_cookie == NULL)){
socket()->error_state(I18N_NOOP("Close packet from server"));
return;
}
QCString host = tlv_host->byteArray().data();
int idx = host.find(':');
if (idx == -1){
log(L_ERROR, "Bad host address %s", host.data());
socket()->error_state(I18N_NOOP("Bad host address"));
return;
}
unsigned short port = host.mid(idx + 1).toUShort();
host = host.left(idx);
socket()->close();
socket()->connect(host, port, this);
m_cookie = tlv_cookie->byteArray();
m_cookie.resize(m_cookie.size() - 1); // tlv has \0 terminator... time for Qt4
}
示例4: user_file
void MigrateDialog::process()
{
unsigned size = 0;
for (list<QCheckBox*>::iterator it = m_boxes.begin(); it != m_boxes.end(); ++it){
if (!(*it)->isChecked())
continue;
QString path = user_file((*it)->text());
path += '/';
icqConf.close();
clientsConf.close();
contactsConf.close();
icqConf.setName(path + "icq.conf");
clientsConf.setName(path + "clients.conf");
contactsConf.setName(path + "contacts.conf");
lblStatus->setText(path + "icq.conf");
if (!icqConf.open(IO_ReadOnly)){
error(i18n("Can't open %1") .arg(path + "icq.conf"));
return;
}
if (!clientsConf.open(IO_WriteOnly | IO_Truncate)){
error(i18n("Can't open %1") .arg(path + "clients.conf"));
return;
}
if (!contactsConf.open(IO_WriteOnly | IO_Truncate)){
error(i18n("Can't open %1") .arg(path + "contacts.conf"));
return;
}
m_uin = 0;
m_passwd = "";
m_state = 0;
m_grpId = 0;
m_contactId = 0;
Buffer cfg;
cfg.init(icqConf.size());
icqConf.readBlock(cfg.data(), icqConf.size());
for (;;){
QCString section = cfg.getSection();
if (section.isEmpty())
break;
m_state = 3;
if (section == "Group")
m_state = 1;
if (section == "User")
m_state = 2;
if (!m_bProcess)
return;
for (;;){
QCString l = cfg.getLine();
if (l.isEmpty())
break;
QCString line = l;
QCString name = getToken(line, '=');
if (name == "UIN")
m_uin = line.toUInt();
if (name == "EncryptPassword")
m_passwd = line;
if (name == "Name")
m_name = line;
if (name == "Alias")
m_name = line;
}
flush();
barCnv->setProgress(cfg.readPos());
qApp->processEvents();
}
icqConf.close();
clientsConf.close();
contactsConf.close();
m_state = 3;
size += icqConf.size();
if (!m_bProcess)
return;
barCnv->setProgress(size);
qApp->processEvents();
QString h_path = path;
#ifdef WIN32
h_path += "history\\";
#else
h_path += "history/";
#endif
QDir history(h_path);
QStringList l = history.entryList("*.history", QDir::Files);
for (QStringList::Iterator it = l.begin(); it != l.end(); ++it){
hFrom.close();
hTo.close();
hFrom.setName(h_path + (*it));
lblStatus->setText(h_path + (*it));
hTo.setName(h_path + QString(m_owner) + '.' + (*it).left((*it).find('.')));
if (!hFrom.open(IO_ReadOnly)){
error(i18n("Can't open %1") .arg(hFrom.name()));
return;
}
if (!hTo.open(IO_WriteOnly | IO_Truncate)){
error(i18n("Can't open %1") .arg(hTo.name()));
return;
}
cfg.init(hFrom.size());
hFrom.readBlock(cfg.data(), hFrom.size());
for (;;){
QCString section = cfg.getSection();
//.........这里部分代码省略.........
示例5: mocify
static CWResult mocify(CWPluginContext context, const QCString &source)
{
CWDisplayLines(context, line_count++);
source.stripWhiteSpace();
CWResult err;
bool dotmoc=false;
QCString stem = source, ext;
int dotpos = stem.findRev('.');
if(dotpos != -1) {
ext = stem.right(stem.length() - (dotpos+1));
stem = stem.left(dotpos);
if(ext == "cpp")
dotmoc = true;
} else {
//whoa!
}
QCString dest;
if(dotmoc)
dest = stem + ".moc";
else
dest = "moc_" + stem + ".cpp";
//moc it
CWFileSpec destSpec;
moc_status mocd = do_moc(context, source, dest, &destSpec, dotmoc);
#if 0
QCString derr = "Weird";
switch(mocd) {
case moc_success: derr = "Success"; break;
case moc_parse_error: derr = "Parser Error"; break;
case moc_no_qobject:derr = "No QOBJECT"; break;
case moc_not_time: derr = "Not Time"; break;
case moc_no_source: derr = "No Source"; break;
case moc_general_error: derr = "General Error"; break;
}
char dmsg[200];
sprintf(dmsg, "\"%s\" %s", source.data(), derr.data());
CWReportMessage(context, NULL, dmsg, NULL, messagetypeError, 0);
#endif
//handle project
if(mocd == moc_no_qobject) {
char msg[400];
sprintf(msg, "\"%s\" No relevant classes found. No output generated.", source.data());
CWReportMessage(context, NULL, msg, NULL, messagetypeWarning, 0);
} else if ((mocd == moc_success || mocd == moc_not_time) && !dotmoc)
{
long whichFile;
CWNewProjectEntryInfo ei;
memset(&ei, '\0', sizeof(ei));
ei.groupPath = "QtGenerated";
err = CWAddProjectEntry(context, &destSpec, true, &ei, &whichFile);
if (!CWSUCCESS(err))
{
char msg[200];
sprintf(msg, "\"%s\" not added", dest.data());
CWReportMessage(context, NULL, msg, NULL, messagetypeWarning, 0);
}
if(mocd == moc_success)
CWSetModDate(context, &destSpec, NULL, true);
}
return cwNoErr;
}
示例6: if
bool ClassContainer::read_type(UmlTypeSpec & typespec, Class ** cl,
const QValueList<FormalParameterList> & tmplts,
QValueList<UmlTypeSpec> * actuals,
QCString & str_actuals, QCString s,
UmlClass ** first_actual_class, QCString & def,
QCString & genericname) {
str_actuals = 0;
if (actuals != 0)
actuals->clear();
if (s.isEmpty() && (s = Lex::read_word()).isEmpty()) {
Lex::premature_eof();
return FALSE;
}
QCString path; // type without <..>
QCString type; // real type form
bool internal_template = FALSE; // true if type is ...<...>...
int pfixdef_length = 0; // generic form including first class
int first_actual_class_length = 0; // first class's name length
genericname = s;
for (;;) {
internal_template = (path != type);
path += s;
type += s;
s = Lex::read_word();
if (s != "<")
break;
type += s;
str_actuals = s;
// read <...>
do {
Lex::mark();
int level = 0;
QCString firstword; // first element in current actual
int pfixlen = 0; // type length including firstword
for (;;) {
s = Lex::read_word(TRUE);
if (s == ",") {
if (level == 0)
break;
}
else if (s == ">") {
if (level-- == 0)
break;
}
else if (s == "]")
level -= 1;
else if ((s == "<") || (s == "["))
level += 1;
else if (s.isEmpty()) {
Lex::premature_eof();
return FALSE;
}
else if (firstword.isEmpty()) {
firstword = s;
pfixlen = type.length() + Lex::region().length();
}
}
QCString e = Lex::region();
type += e;
str_actuals += e;
if (actuals != 0) {
UmlTypeSpec t;
e.resize(e.length()); // remove , or >
e = e.stripWhiteSpace();
if (! e.isEmpty())
compute_type(e, t, tmplts);
if (actuals != 0)
actuals->append(t);
}
else if ((first_actual_class != 0) &&
(*first_actual_class == 0) &&
!firstword.isEmpty()) {
UmlTypeSpec t;
compute_type(firstword, t, tmplts);
if (t.type != 0) {
*first_actual_class = t.type;
first_actual_class_length = firstword.length();
pfixdef_length = pfixlen - first_actual_class_length;
}
}
} while (s == ",");
s = Lex::read_word();
//.........这里部分代码省略.........
示例7: kdemain
extern "C" KDE_EXPORT int kdemain(int argc, char *argv[])
{
bool restored = false;
for(int arg = 1; arg < argc; arg++)
{
if(!qstrcmp(argv[arg], "-session"))
{
restored = true;
break;
}
}
if(!restored)
{
// we only do the multihead fork if we are not restored by the session
// manager, since the session manager will register multiple kwins,
// one for each screen...
QCString multiHead = getenv("KDE_MULTIHEAD");
if(multiHead.lower() == "true")
{
Display *dpy = XOpenDisplay(NULL);
if(!dpy)
{
fprintf(stderr, "%s: FATAL ERROR while trying to open display %s\n", argv[0], XDisplayName(NULL));
exit(1);
}
int number_of_screens = ScreenCount(dpy);
KWinInternal::screen_number = DefaultScreen(dpy);
int pos; // temporarily needed to reconstruct DISPLAY var if multi-head
QCString display_name = XDisplayString(dpy);
XCloseDisplay(dpy);
dpy = 0;
if((pos = display_name.findRev('.')) != -1)
display_name.remove(pos, 10); // 10 is enough to be sure we removed ".s"
QCString envir;
if(number_of_screens != 1)
{
for(int i = 0; i < number_of_screens; i++)
{
// if execution doesn't pass by here, then kwin
// acts exactly as previously
if(i != KWinInternal::screen_number && fork() == 0)
{
KWinInternal::screen_number = i;
// break here because we are the child process, we don't
// want to fork() anymore
break;
}
}
// in the next statement, display_name shouldn't contain a screen
// number. If it had it, it was removed at the "pos" check
envir.sprintf("DISPLAY=%s.%d", display_name.data(), KWinInternal::screen_number);
if(putenv(strdup(envir.data())))
{
fprintf(stderr, "%s: WARNING: unable to set DISPLAY environment variable\n", argv[0]);
perror("putenv()");
}
}
}
}
KGlobal::locale()->setMainCatalogue("kwin");
KAboutData aboutData("kwin", I18N_NOOP("KWin"), version, description, KAboutData::License_GPL, I18N_NOOP("(c) 1999-2005, The KDE Developers"));
aboutData.addAuthor("Matthias Ettrich", 0, "[email protected]");
aboutData.addAuthor("Cristian Tibirna", 0, "[email protected]");
aboutData.addAuthor("Daniel M. Duley", 0, "[email protected]");
aboutData.addAuthor("Luboš Luňák", I18N_NOOP("Maintainer"), "[email protected]");
KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineArgs::addCmdLineOptions(args);
if(signal(SIGTERM, KWinInternal::sighandler) == SIG_IGN)
signal(SIGTERM, SIG_IGN);
if(signal(SIGINT, KWinInternal::sighandler) == SIG_IGN)
signal(SIGINT, SIG_IGN);
if(signal(SIGHUP, KWinInternal::sighandler) == SIG_IGN)
signal(SIGHUP, SIG_IGN);
KApplication::disableAutoDcopRegistration();
KWinInternal::Application a;
KWinInternal::SessionManaged weAreIndeed;
KWinInternal::SessionSaveDoneHelper helper;
fcntl(ConnectionNumber(qt_xdisplay()), F_SETFD, 1);
QCString appname;
if(KWinInternal::screen_number == 0)
appname = "kwin";
else
appname.sprintf("kwin-screen-%d", KWinInternal::screen_number);
DCOPClient *client = a.dcopClient();
client->registerAs(appname.data(), false);
client->setDefaultObject("KWinInterface");
//.........这里部分代码省略.........
示例8: dcopRef
void
CollectionScanner::readDir( const QString& dir, QStringList& entries )
{
static DCOPRef dcopRef( "amarok", "collection" );
// linux specific, but this fits the 90% rule
if( dir.startsWith( "/dev" ) || dir.startsWith( "/sys" ) || dir.startsWith( "/proc" ) )
return;
const QCString dir8Bit = QFile::encodeName( dir );
struct stat statBuf;
stat( dir8Bit, &statBuf );
struct direntry de;
memset(&de, 0, sizeof(struct direntry));
de.dev = statBuf.st_dev;
de.ino = statBuf.st_ino;
int f = -1;
#if __GNUC__ < 4
for( unsigned int i = 0; i < m_processedDirs.size(); ++i )
if( memcmp( &m_processedDirs[i], &de, sizeof( direntry ) ) == 0 ) {
f = i; break;
}
#else
f = m_processedDirs.find( de );
#endif
if ( ! S_ISDIR( statBuf.st_mode ) || f != -1 ) {
debug() << "Skipping, already scanned: " << dir << endl;
return;
}
AttributeMap attributes;
attributes["path"] = dir;
writeElement( "folder", attributes );
m_processedDirs.resize( m_processedDirs.size() + 1 );
m_processedDirs[m_processedDirs.size() - 1] = de;
DIR *d = opendir( dir8Bit );
if( d == NULL ) {
if( errno == EACCES )
warning() << "Skipping, no access permissions: " << dir << endl;
return;
}
for( dirent *ent; ( ent = readdir( d ) ); ) {
QCString entry (ent->d_name);
QCString entryname (ent->d_name);
if ( entry == "." || entry == ".." )
continue;
entry.prepend( dir8Bit );
if ( stat( entry, &statBuf ) != 0 )
continue;
// loop protection
if ( ! ( S_ISDIR( statBuf.st_mode ) || S_ISREG( statBuf.st_mode ) ) )
continue;
if ( S_ISDIR( statBuf.st_mode ) && m_recursively && entry.length() && entryname[0] != '.' )
{
const QString file = QFile::decodeName( entry );
bool isInCollection = false;
if( m_incremental )
dcopRef.call( "isDirInCollection", file ).get( isInCollection );
if( !m_incremental || !isInCollection )
// we MUST add a '/' after the dirname
readDir( file + '/', entries );
}
else if( S_ISREG( statBuf.st_mode ) )
entries.append( QFile::decodeName( entry ) );
}
closedir( d );
}
示例9: QCString
QCString File::context() {
QCString s;
return QCString(name()) + " line " + s.setNum(line_number);
}
示例10: init
void KFileItem::init( bool _determineMimeTypeOnDemand )
{
m_access = QString::null;
m_size = (KIO::filesize_t) -1;
// metaInfo = KFileMetaInfo();
for ( int i = 0; i < NumFlags; i++ )
m_time[i] = (time_t) -1;
// determine mode and/or permissions if unknown
if ( m_fileMode == KFileItem::Unknown || m_permissions == KFileItem::Unknown )
{
mode_t mode = 0;
if ( m_url.isLocalFile() )
{
/* directories may not have a slash at the end if
* we want to stat() them; it requires that we
* change into it .. which may not be allowed
* stat("/is/unaccessible") -> rwx------
* stat("/is/unaccessible/") -> EPERM H.Z.
* This is the reason for the -1
*/
KDE_struct_stat buf;
QCString path = QFile::encodeName(m_url.path( -1 ));
if ( KDE_lstat( path.data(), &buf ) == 0 )
{
mode = buf.st_mode;
if ( S_ISLNK( mode ) )
{
m_bLink = true;
if ( KDE_stat( path.data(), &buf ) == 0 )
mode = buf.st_mode;
else // link pointing to nowhere (see kio/file/file.cc)
mode = (S_IFMT-1) | S_IRWXU | S_IRWXG | S_IRWXO;
}
// While we're at it, store the times
m_time[ Modification ] = buf.st_mtime;
m_time[ Access ] = buf.st_atime;
if ( m_fileMode == KFileItem::Unknown )
m_fileMode = mode & S_IFMT; // extract file type
if ( m_permissions == KFileItem::Unknown )
m_permissions = mode & 07777; // extract permissions
}
}
}
// determine the mimetype
if (!m_pMimeType && !m_url.isEmpty())
{
bool accurate = false;
bool isLocalURL;
KURL url = mostLocalURL(isLocalURL);
m_pMimeType = KMimeType::findByURL( url, m_fileMode, isLocalURL,
// use fast mode if not mimetype on demand
_determineMimeTypeOnDemand, &accurate );
//kdDebug() << "finding mimetype for " << url.url() << " : " << m_pMimeType->name() << endl;
// if we didn't use fast mode, or if we got a result, then this is the mimetype
// otherwise, determineMimeType will be able to do better.
m_bMimeTypeKnown = (!_determineMimeTypeOnDemand) || accurate;
}
}
示例11: mult_column
unsigned PythonSettings::mult_column(const QCString & mult)
{
return (mult.isEmpty() || (mult == "1")) ? 0 : 1;
}
示例12: handleCommentBlock
void VhdlParser::handleCommentBlock(const char* doc1,bool brief)
{
int position=0;
static bool isIn;
QCString doc;
doc.append(doc1);
// fprintf(stderr,"\n %s",doc.data());
if (doc.isEmpty()) return;
if (checkMultiComment(doc,yyLineNr))
{
strComment.resize(0);
return;
}
isIn=checkInlineCode(doc);
bool isEndCode=doc.contains("\\endcode");
// empty comment --!
if (isEndCode)
{
int end=inputString.find(doc.data(),iCodeLen);
makeInlineDoc(end);
strComment.resize(0);
isIn=false;
}
if (isIn)
{
isIn=false;
return;
}
VhdlDocGen::prepareComment(doc);
bool needsEntry=FALSE;
Protection protection=Public;
int lineNr;
if (iDocLine==-1)
lineNr=yyLineNr;
if (oldEntry==current)
{
//printf("\n find pending message < %s > at line: %d \n ",doc.data(),iDocLine);
str_doc.doc=doc;
str_doc.iDocLine=iDocLine;
str_doc.brief=brief;
str_doc.pending=TRUE;
return;
}
oldEntry=current;
if (brief)
{
current->briefLine = yyLineNr;
}
else
{
current->docLine = yyLineNr;
}
// printf("parseCommentBlock file<%s>\n [%s]\n at line [%d] \n ",yyFileName.data(),doc.data(),iDocLine);
int j=doc.find("[plant]");
if (j>=0)
{
doc=doc.remove(j,7);
current->stat=true;
}
while (parseCommentBlock(
g_thisParser,
current,
doc, // text
yyFileName, // file
iDocLine, // line of block start
brief,
0,
FALSE,
protection,
position,
needsEntry
)
)
{
//printf("parseCommentBlock position=%d [%s]\n",position,doc.data()+position);
if (needsEntry) newEntry();
}
if (needsEntry)
{
if (varr)
{
varr=FALSE;
current->name=varName;
current->section=Entry::VARIABLEDOC_SEC;
varName="";
}
newEntry();
}
iDocLine=-1;
strComment.resize(0);
}
示例13: isConstraintFile
bool isConstraintFile(const QCString &fileName,const QCString &ext)
{
return fileName.right(ext.length())==ext;
}
示例14: Config_getString
/*! This will create a contents file (index.hhc) and a index file (index.hhk)
* and write the header of those files.
* It also creates a project file (index.hhp)
* \sa finalize()
*/
void HtmlHelp::initialize()
{
const char *str = Config_getString("CHM_INDEX_ENCODING");
if (!str) str = "CP1250"; // use safe and likely default
m_fromUtf8 = portable_iconv_open(str,"UTF-8");
if (m_fromUtf8==(void *)(-1))
{
err("unsupported character conversion for CHM_INDEX_ENCODING: '%s'->'UTF-8'\n", str);
exit(1);
}
/* open the contents file */
QCString fName = Config_getString("HTML_OUTPUT") + "/index.hhc";
cf = new QFile(fName);
if (!cf->open(IO_WriteOnly))
{
err("Could not open file %s for writing\n",fName.data());
exit(1);
}
/* Write the header of the contents file */
cts.setDevice(cf);
cts << "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n"
"<HTML><HEAD></HEAD><BODY>\n"
"<OBJECT type=\"text/site properties\">\n"
"<param name=\"FrameName\" value=\"right\">\n"
"</OBJECT>\n"
"<UL>\n";
/* open the contents file */
fName = Config_getString("HTML_OUTPUT") + "/index.hhk";
kf = new QFile(fName);
if (!kf->open(IO_WriteOnly))
{
err("Could not open file %s for writing\n",fName.data());
exit(1);
}
/* Write the header of the contents file */
kts.setDevice(kf);
kts << "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n"
"<HTML><HEAD></HEAD><BODY>\n"
"<OBJECT type=\"text/site properties\">\n"
"<param name=\"FrameName\" value=\"right\">\n"
"</OBJECT>\n"
"<UL>\n";
/* language codes for Html help
0x405 Czech
0x406 Danish
0x413 Dutch
0xC09 English (Australia)
0x809 English (Britain)
0x1009 English (Canada)
0x1809 English (Ireland)
0x1409 English (New Zealand)
0x1C09 English (South Africa)
0x409 English (United States)
0x40B Finnish
0x40C French
0x407 German
0x408 Greece
0x40E Hungarian
0x410 Italian
0x814 Norwegian
0x415 Polish
0x816 Portuguese(Portugal)
0x416 Portuguese(Brazil)
0x419 Russian
0x80A Spanish(Mexico)
0xC0A Spanish(Modern Sort)
0x40A Spanish(Traditional Sort)
0x41D Swedish
0x41F Turkey
0x411 Japanese
0x412 Korean
0x804 Chinese (PRC)
0x404 Chinese (Taiwan)
New LCIDs:
0x421 Indonesian
0x41A Croatian
0x418 Romanian
0x424 Slovenian
0x41B Slovak
0x422 Ukrainian
0x81A Serbian (Serbia, Latin)
0x403 Catalan
0x426 Latvian
0x427 Lithuanian
0x436 Afrikaans
0x42A Vietnamese
0x429 Persian (Iran)
0xC01 Arabic (Egypt) - I don't know which version of arabic is used inside translator_ar.h ,
so I have chosen Egypt at random
*/
//.........这里部分代码省略.........
示例15: Q_UNUSED
bool KoApplication::start()
{
ResetStarting resetStarting; // reset m_starting to false when we're done
Q_UNUSED( resetStarting );
// Find the *.desktop file corresponding to the kapp instance name
KoDocumentEntry entry = KoDocumentEntry( KoDocument::readNativeService() );
if ( entry.isEmpty() )
{
kdError( 30003 ) << instanceName() << "part.desktop not found." << endl;
kdError( 30003 ) << "Run 'kde-config --path services' to see which directories were searched, assuming kde startup had the same environment as your current shell." << endl;
kdError( 30003 ) << "Check your installation (did you install KOffice in a different prefix than KDE, without adding the prefix to /etc/kderc ?)" << endl;
return false;
}
// Get the command line arguments which we have to parse
KCmdLineArgs *args= KCmdLineArgs::parsedArgs();
int argsCount = args->count();
KCmdLineArgs *koargs = KCmdLineArgs::parsedArgs("koffice");
QCString dpiValues = koargs->getOption( "dpi" );
if ( !dpiValues.isEmpty() ) {
int sep = dpiValues.find( QRegExp( "[x, ]" ) );
int dpiX;
int dpiY = 0;
bool ok = true;
if ( sep != -1 ) {
dpiY = dpiValues.mid( sep+1 ).toInt( &ok );
dpiValues.truncate( sep );
}
if ( ok ) {
dpiX = dpiValues.toInt( &ok );
if ( ok ) {
if ( !dpiY ) dpiY = dpiX;
KoGlobal::setDPI( dpiX, dpiY );
}
}
}
// No argument -> create an empty document
if ( !argsCount ) {
KoDocument* doc = entry.createDoc( 0, "Document" );
if ( !doc )
return false;
KoMainWindow *shell = new KoMainWindow( doc->instance() );
shell->show();
QObject::connect(doc, SIGNAL(sigProgress(int)), shell, SLOT(slotProgress(int)));
// for initDoc to fill in the recent docs list
// and for KoDocument::slotStarted
doc->addShell( shell );
if ( doc->checkAutoSaveFile() ) {
shell->setRootDocument( doc );
} else {
doc->showStartUpWidget( shell );
}
// FIXME This needs to be moved someplace else
QObject::disconnect(doc, SIGNAL(sigProgress(int)), shell, SLOT(slotProgress(int)));
} else {
bool print = koargs->isSet("print");
bool doTemplate = koargs->isSet("template");
koargs->clear();
// Loop through arguments
short int n=0; // number of documents open
short int nPrinted = 0;
for(int i=0; i < argsCount; i++ )
{
// For now create an empty document
KoDocument* doc = entry.createDoc( 0 );
if ( doc )
{
// show a shell asap
KoMainWindow *shell = new KoMainWindow( doc->instance() );
if (!print)
shell->show();
// are we just trying to open a template?
if ( doTemplate ) {
QStringList paths;
if ( args->url(i).isLocalFile() && QFile::exists(args->url(i).path()) )
{
paths << QString(args->url(i).path());
kdDebug(30003) << "using full path..." << endl;
} else {
QString desktopName(args->arg(i));
QString appName = KGlobal::instance()->instanceName();
paths = KGlobal::dirs()->findAllResources("data", appName +"/templates/*/" + desktopName );
if ( paths.isEmpty()) {
paths = KGlobal::dirs()->findAllResources("data", appName +"/templates/" + desktopName );
}
if ( paths.isEmpty()) {
KMessageBox::error(0L, i18n("No template found for: %1 ").arg(desktopName) );
delete shell;
} else if ( paths.count() > 1 ) {
KMessageBox::error(0L, i18n("Too many templates found for: %1").arg(desktopName) );
delete shell;
}
//.........这里部分代码省略.........