コード例 #1
0
ファイル: FbAuthorDlg.cpp プロジェクト: EvgeniiFrolov/myrulib
void FbAuthorModifyDlg::DoModify()
{
	AuthorItem author(m_id);
	GetValues(author);
	author.Save(m_database);
	FbCollection::ResetAuth(m_id);
}
コード例 #2
0
ファイル: qlcfixturedef.cpp プロジェクト: cderek99/qlcplus
QFile::FileError QLCFixtureDef::saveXML(const QString& fileName)
{
    QFile::FileError error;

    if (fileName.isEmpty() == true)
        return QFile::OpenError;

    QFile file(fileName);
    if (file.open(QIODevice::WriteOnly) == false)
        return file.error();

    QDomDocument doc(QLCFile::getXMLHeader(KXMLQLCFixtureDefDocument, author()));
    Q_ASSERT(doc.isNull() == false);

    /* Create a text stream for the file */
    QTextStream stream(&file);
    stream.setAutoDetectUnicode(true);
    stream.setCodec("UTF-8");

    /* Fixture tag */
    QDomElement root = doc.documentElement();

    QDomElement tag;
    QDomText text;

    /* Manufacturer */
    tag = doc.createElement(KXMLQLCFixtureDefManufacturer);
    root.appendChild(tag);
    text = doc.createTextNode(m_manufacturer);
    tag.appendChild(text);

    /* Model */
    tag = doc.createElement(KXMLQLCFixtureDefModel);
    root.appendChild(tag);
    text = doc.createTextNode(m_model);
    tag.appendChild(text);

    /* Type */
    tag = doc.createElement(KXMLQLCFixtureDefType);
    root.appendChild(tag);
    text = doc.createTextNode(m_type);
    tag.appendChild(text);

    /* Channels */
    QListIterator <QLCChannel*> chit(m_channels);
    while (chit.hasNext() == true)
        chit.next()->saveXML(&doc, &root);

    /* Modes */
    QListIterator <QLCFixtureMode*> modeit(m_modes);
    while (modeit.hasNext() == true)
        modeit.next()->saveXML(&doc, &root);

    /* Write the document into the stream */
    stream << doc.toString();
    error = QFile::NoError;
    file.close();

    return error;
}
コード例 #3
0
ファイル: rss.cpp プロジェクト: alpha-omega/newsbeuter
std::string rss_item::get_attribute(const std::string& attribname) {
	if (attribname == "title")
		return title();
	else if (attribname == "link")
		return link();
	else if (attribname == "author")
		return author();
	else if (attribname == "content")
		return description();
	else if (attribname == "date")
		return pubDate();
	else if (attribname == "guid")
		return guid();
	else if (attribname == "unread")
		return unread_ ? "yes" : "no";
	else if (attribname == "enclosure_url")
		return enclosure_url();
	else if (attribname == "enclosure_type")
		return enclosure_type();
	else if (attribname == "flags")
		return flags();
	else if (attribname == "age")
		return utils::to_s((time(NULL) - pubDate_timestamp()) / 86400);
	else if (attribname == "articleindex")
		return utils::to_s(idx);

	// if we have a feed, then forward the request
	if (feedptr)
		return feedptr->rss_feed::get_attribute(attribname);

	return "";
}
コード例 #4
0
ファイル: podcastepisode.cpp プロジェクト: GitAnt/Clementine
Song PodcastEpisode::ToSong(const Podcast& podcast) const {
  Song ret;
  ret.set_valid(true);
  ret.set_title(title().simplified());
  ret.set_artist(author().simplified());
  ret.set_length_nanosec(kNsecPerSec * duration_secs());
  ret.set_year(publication_date().date().year());
  ret.set_comment(description());

  if (downloaded() && QFile::exists(local_url().toLocalFile())) {
    ret.set_url(local_url());
  } else {
    ret.set_url(url());
  }

  ret.set_basefilename(QFileInfo(ret.url().path()).fileName());

  // Use information from the podcast if it's set
  if (podcast.is_valid()) {
    ret.set_album(podcast.title().simplified());
    ret.set_art_automatic(podcast.ImageUrlLarge().toString());
  }

  return ret;
}
コード例 #5
0
ファイル: history_item.cpp プロジェクト: JuanPotato/tdesktop
QString HistoryItem::inDialogsText(DrawInDialog way) const {
	auto getText = [this]() {
		if (_media) {
			return _media->chatListText();
		} else if (!emptyText()) {
			return TextUtilities::Clean(_text.originalText());
		}
		return QString();
	};
	const auto plainText = getText();
	const auto sender = [&]() -> PeerData* {
		if (isPost() || isEmpty() || (way == DrawInDialog::WithoutSender)) {
			return nullptr;
		} else if (!_history->peer->isUser() || out()) {
			return author();
		} else if (_history->peer->isSelf() && !Has<HistoryMessageForwarded>()) {
			return senderOriginal();
		}
		return nullptr;
	}();
	if (sender) {
		auto fromText = sender->isSelf() ? lang(lng_from_you) : sender->shortName();
		auto fromWrapped = textcmdLink(1, lng_dialogs_text_from_wrapped(lt_from, TextUtilities::Clean(fromText)));
		return lng_dialogs_text_with_from(lt_from_part, fromWrapped, lt_message, plainText);
	}
	return plainText;
}
コード例 #6
0
ファイル: pUpdateCheckerDialog.cpp プロジェクト: pasnox/fresh
QString pUpdateItem::toolTip() const
{
    return content().replace(
        QRegExp( QSL( "<a.*</a>" ) ), pUpdateCheckerDialog::tr( QT_TRANSLATE_NOOP( "pUpdateCheckerDialog", "Updated on %1 by %2" ) )
            .arg( updated().toString( Qt::DefaultLocaleLongDate ) )
            .arg( author() )
    );
}
コード例 #7
0
ファイル: tac_plus.c プロジェクト: Babar/tac_plus
/*
 * Determine the packet type, read the rest of the packet data,
 * decrypt it and call the appropriate service routine.
 */
void
start_session(void)
{
    u_char *pak;
    HDR *hdr;

    do {
	session.seq_no = 0;
	session.aborted = 0;
	session.version = 0;

	pak = read_packet();
	if (pak == NULL)
	    break;

	if (debug & DEBUG_PACKET_FLAG) {
	    report(LOG_DEBUG, "validation request from %s", session.peer);
	    dump_nas_pak(pak);
	}
	hdr = (HDR *)pak;

	session.session_id = ntohl(hdr->session_id);

	/* Do some version checking */
	if (bad_version_check(pak)) {
	    free(pak);
	    break;
	}

	switch (hdr->type) {
	case TAC_PLUS_AUTHEN:
	    authen(pak);
	    free(pak);
	    break;

	case TAC_PLUS_AUTHOR:
	    author(pak);
	    free(pak);
	    break;

	case TAC_PLUS_ACCT:
	    accounting(pak);
	    free(pak);
	    break;

	default:
	    /* Note: can't send error reply if type is unknown */
	    report(LOG_ERR, "Illegal type %d in received packet", hdr->type);
	    free(pak);
	    goto OUT;
	}
    } while (!(session.flags & SESS_NO_SINGLECONN) &&
	     session.peerflags & TAC_PLUS_SINGLE_CONNECT_FLAG);

OUT:
    if (debug & DEBUG_PACKET_FLAG)
	report(LOG_DEBUG, "%s: disconnect", session.peer);
}
コード例 #8
0
ファイル: FbAuthorDlg.cpp プロジェクト: EvgeniiFrolov/myrulib
bool FbAuthorModifyDlg::Load(int id)
{
	AuthorItem author(id);
	bool ok = author.Load(m_database);
	SetValue(ID_LAST_NAME, author.last);
	SetValue(ID_FIRST_NAME, author.first);
	SetValue(ID_MIDDLE_NAME, author.middle);
	return ok;
}
コード例 #9
0
ファイル: UGC.cpp プロジェクト: milchakov/omim
 jobject ToJavaReview(JNIEnv * env, ugc::Review const & review)
 {
   jni::TScopedLocalRef text(env, jni::ToJavaString(env, review.m_text.m_text));
   jni::TScopedLocalRef author(env, jni::ToJavaString(env, review.m_author));
   jobject result = env->NewObject(m_reviewClass, m_reviewCtor, text.get(), author.get(),
                                   ugc::ToMillisecondsSinceEpoch(review.m_time), review.m_rating,
                                   ToImpress(review.m_rating));
   ASSERT(result, ());
   return result;
 }
コード例 #10
0
TEST (kdbrestModelsEntryTest, SetAndGetAuthor)
{

	kdb::Key key (kdbrest::Config::instance ().getConfig ().get<std::string> ("kdb.path.configs") + std::string ("/test/key1"),
		      KEY_END);
	kdbrest::model::Entry entry (key);
	std::string author ("the author");
	entry.setAuthor (author);
	ASSERT_EQ (author, entry.getAuthor ());
}
コード例 #11
0
ファイル: 4_3.cpp プロジェクト: tcsabina/Cpp4C
int main() {
    char* str = "The wheel that squeaks the loudest\n";
    string a(str), b, author("Josh Billings\n"), both, quote;

    b.assign("Is the one that gets the grease\n");
    both.concat(a, b);
    quote.concat(both, author);
    quote.print();

    return 0;
}
コード例 #12
0
ファイル: BibTeXFile.cpp プロジェクト: mojca/texworks
void BibTeXFile::Entry::updateCache()
{
	// invalidate cache so that all subsequent method calls actually search the
	// fields
	_cache.valid = false;
	_cache.author = author();
	_cache.howPublished = howPublished();
	_cache.title = title();
	_cache.year = year();
	_cache.valid = true;
}
コード例 #13
0
ファイル: qlcfixturedef.cpp プロジェクト: PML369/qlcplus
QFile::FileError QLCFixtureDef::saveXML(const QString& fileName)
{
    QFile::FileError error;

    if (fileName.isEmpty() == true)
        return QFile::OpenError;

    QString tempFileName(fileName);
    tempFileName += ".temp";
    QFile file(tempFileName);
    if (file.open(QIODevice::WriteOnly) == false)
        return file.error();

    QXmlStreamWriter doc(&file);
    doc.setAutoFormatting(true);
    doc.setAutoFormattingIndent(1);
    doc.setCodec("UTF-8");
    QLCFile::writeXMLHeader(&doc, KXMLQLCFixtureDefDocument, author());

    doc.writeTextElement(KXMLQLCFixtureDefManufacturer, m_manufacturer);
    doc.writeTextElement(KXMLQLCFixtureDefModel, m_model);
    doc.writeTextElement(KXMLQLCFixtureDefType, m_type);

    /* Channels */
    QListIterator <QLCChannel*> chit(m_channels);
    while (chit.hasNext() == true)
        chit.next()->saveXML(&doc);

    /* Modes */
    QListIterator <QLCFixtureMode*> modeit(m_modes);
    while (modeit.hasNext() == true)
        modeit.next()->saveXML(&doc);

    /* End the document and close all the open elements */
    error = QFile::NoError;
    doc.writeEndDocument();
    file.close();

    // Save to actual requested file name
    QFile currFile(fileName);
    if (currFile.exists() && !currFile.remove())
    {
        qWarning() << "Could not erase" << fileName;
        return currFile.error();
    }
    if (!file.rename(fileName))
    {
        qWarning() << "Could not rename" << tempFileName << "to" << fileName;
        return file.error();
    }

    return error;
}
コード例 #14
0
void HistoryMessage::applyGroupAdminChanges(
		const base::flat_map<UserId, bool> &changes) {
	auto i = changes.find(peerToUser(author()->id));
	if (i != changes.end()) {
		if (i->second) {
			_flags |= MTPDmessage_ClientFlag::f_has_admin_badge;
		} else {
			_flags &= ~MTPDmessage_ClientFlag::f_has_admin_badge;
		}
		Auth().data().requestItemResize(this);
	}
}
コード例 #15
0
PMLibraryHandle::PMResult PMLibraryHandle::saveLibraryInfo( )
{
   // Save the information to the index
   QFile file( m_path + "/library_index.xml" );
   if( !file.open( IO_WriteOnly ) )
   {
      return PMLibraryHandle::CouldNotCreateInfo;
   }

   // Create the XML DOM tree
   QDomDocument doc( "KPOVLIBINDEX" );
   QDomElement e = doc.createElement( "library" );
   e.setAttribute( "name", name( ) );
   e.setAttribute( "author", author( ) );
   e.setAttribute( "description", description( ) );
   if( m_readOnly )
      e.setAttribute( "readonly", "true" );
   else
      e.setAttribute( "readonly", "false" );

   if( m_subLibrary )
      e.setAttribute( "sublibrary", "true" );
   else
      e.setAttribute( "sublibrary", "false" );

   // Add the object list to the tree
   QDomElement l = doc.createElement( "object_list" );
   for(QDictIterator<QString> it( m_objects ); it.current( ); ++it )
   {
      QDomElement n = doc.createElement( "object_entry" );
      n.setAttribute( "name", it.currentKey( ) );
      n.setAttribute( "file", *( it.current( ) ) );
      l.appendChild( n );
   }
   for(QDictIterator<QString> it( m_libraries ); it.current( ); ++it )
   {
      QDomElement n = doc.createElement( "library_entry" );
      n.setAttribute( "name", it.currentKey( ) );
      n.setAttribute( "file", *( it.current( ) ) );
      l.appendChild( n );
   }
   e.appendChild( l );
   doc.appendChild( e );

   // Save to the file
   QTextStream str( &file );
   str.setEncoding( QTextStream::UnicodeUTF8 );
   str << doc.toString( );
   file.close( );

   return PMLibraryHandle::Ok;
}
コード例 #16
0
void MX2Importer::parseFile( const QString& filename )
{
	QFile file( filename );
	kDebug() << "loading file: " << filename ;
	if ( file.open( QIODevice::ReadOnly ) ) {
		kDebug() << "file opened" ;
		QDomDocument doc;

		//hopefully a temporary hack, since MasterCook creates invalid xml declarations
		QTextStream stream( &file );
		QString all_data = stream.readAll();
		if ( all_data.startsWith( "<?xml" ) )
			all_data.remove( 0, all_data.indexOf( "?>" ) + 2 );

		QString error;
		int line;
		int column;
		if ( !doc.setContent( all_data, &error, &line, &column ) ) {
			kDebug() << QString( "error: \"%1\" at line %2, column %3" ).arg( error ).arg( line ).arg( column ) ;
			setErrorMsg( i18n( "\"%1\" at line %2, column %3.  This may not be a *.mx2 file.", error, line, column ) );
			return ;
		}

		QDomElement mx2 = doc.documentElement();

		// TODO Check if there are changes between versions
		if ( mx2.tagName() != "mx2" /*|| mx2.attribute("source") != "MasterCook 5.0"*/ ) {
			setErrorMsg( i18n( "This file does not appear to be a *.mx2 file" ) );
			return ;
		}

		QDomNodeList l = mx2.childNodes();

		for ( int i = 0; i < l.count(); i++ ) {
			QDomElement el = l.item( i ).toElement();

			if ( el.tagName() == "RcpE" ) {
				Recipe recipe;
				recipe.title = el.attribute( "name" );

				Element author( el.attribute( "author" ) );
				recipe.authorList.append( author );

				readRecipe( el.childNodes(), &recipe );
				add
					( recipe );
			}
		}
	}
	else
		setErrorMsg( i18n( "Unable to open file." ) );
}
コード例 #17
0
/*
 * init_check:
 *	Check out too see if it is proper to play the game now
 */
init_check()
{
    if (too_much())
    {
	printf("Sorry, %s, but the system is too loaded now.\n", whoami);
	printf("Try again later.  Meanwhile, why not enjoy a%s %s?\n",
	    vowelstr(fruit), fruit);
	if (author())
	    printf("However, since you're a good guy, it's up to you\n");
	else
	    exit(1);
    }
}
コード例 #18
0
void help(void)
{
        fprintf(stderr, "Help for %s:\n", PACKAGE);
	fprintf(stderr, "%s [OPTIONS] [image|directory]\n\n", PACKAGE);
#ifdef HAVE_WGET
        fprintf(stderr, "\t-u, --url\topens (supported format) file after successful fetch with wget\n");
#endif
	fprintf(stderr, "\t-f, --fs\tstarts views in fullscreen\n");
	fprintf(stderr, "\t-l, --longhelp\tprints long help for views\n");
        fprintf(stderr, "\t-v, --version \tprints version info\n");
        fprintf(stderr, "\t-h, --help \tprints this\n\n");
        author();
        death();
}
コード例 #19
0
ファイル: item.cpp プロジェクト: pvuorela/kcalcore
QString Item::debugInfo() const
{
    QString info;
    info += QLatin1String("### Item: ###################\n");
    if (!title().isNull())
        info += QLatin1String("title: #") + title() + QLatin1String("#\n");
    if (!link().isNull())
        info += QLatin1String("link: #") + link() + QLatin1String("#\n");
    if (!description().isNull())
        info += QLatin1String("description: #") + description() + QLatin1String("#\n");
    if (!content().isNull())
        info += QLatin1String("content: #") + content() + QLatin1String("#\n");
    if (!author().isNull())
        info += QLatin1String("author: #") + author() + QLatin1String("#\n");
    if (!comments().isNull())
        info += QLatin1String("comments: #") + comments() + QLatin1String("#\n");
    QString dpubdate = dateTimeToString(pubDate());
    if (!dpubdate.isNull())
        info += QLatin1String("pubDate: #") + dpubdate + QLatin1String("#\n");
    if (!guid().isNull())
        info += QLatin1String("guid: #") + guid() + QLatin1String("#\n");
    if (guidIsPermaLink())
        info += QLatin1String("guid is PL: #true#\n");
    if (!source().isNull())
         info += source().debugInfo();
    
    QList<Category> cats = categories();
    for (QList<Category>::ConstIterator it = cats.constBegin(); it != cats.constEnd(); ++it)
        info += (*it).debugInfo();
    QList<Enclosure> encs = enclosures();
    for (QList<Enclosure>::ConstIterator it = encs.constBegin(); it != encs.constEnd(); ++it)
        info += (*it).debugInfo();

    info += QLatin1String("### Item end ################\n");
    return info;
}
コード例 #20
0
void HistoryMessage::updateAdminBadgeState() {
	auto hasAdminBadge = [&] {
		if (auto channel = history()->peer->asChannel()) {
			if (auto user = author()->asUser()) {
				return channel->isGroupAdmin(user);
			}
		}
		return false;
	}();
	if (hasAdminBadge) {
		_flags |= MTPDmessage_ClientFlag::f_has_admin_badge;
	} else {
		_flags &= ~MTPDmessage_ClientFlag::f_has_admin_badge;
	}
}
コード例 #21
0
int Message::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 3)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 3;
    } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
        if (_id < 3)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 3;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = author(); break;
        }
        _id -= 1;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setAuthor(*reinterpret_cast< QString*>(_v)); break;
        }
        _id -= 1;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 1;
    } else if (_c == QMetaObject::RegisterPropertyMetaType) {
        if (_id < 1)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 1;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
コード例 #22
0
void PluginListWidgetItemDelegate::slotAboutClicked()
{
	auto const index = focusedIndex();
	auto const model = index.model();

	auto info = QString{};
	info += tr("Plugin name: %1").arg(model->data(index, PluginModel::NameRole).toString()) + "\n";

	auto pluginMetadata = model->data(index, PluginModel::MetadataRole).value<PluginMetadata>();
	info += tr("Author: %1").arg(pluginMetadata.author()) + "\n";
	info += tr("Version: %1").arg(pluginMetadata.version()) + "\n";
	info += tr("Description: %1").arg(pluginMetadata.description()) + "\n";
	info += tr("Dependencies: %1").arg(pluginMetadata.dependencies().join(", ")) + "\n";
	info += tr("Provides: %1").arg(pluginMetadata.provides());

	MessageDialog::show(m_iconsManager->iconByPath(KaduIcon("dialog-information")), tr("Plugin information"), info, QMessageBox::Ok, itemView());
}
コード例 #23
0
Mesh* ConvexHull::newMesh(Array<Vector3> points, VertexDescriptor& descriptor,
		GraphicsSystem& graphicsSystem, PhysicsSystem& physicsSystem) {
	GraphicsAPI& graphicsAPI = graphicsSystem.getAPI();

	PxConvexMesh* pxMesh = compute(points, physicsSystem);

	FDUint vertexCount = pxMesh->getNbVertices();
	FDUint byteSize = vertexCount * descriptor.getVertexSize();
	FDUint polygonCount = pxMesh->getNbPolygons();

	GeometryAuthor author(descriptor, graphicsAPI.getDynamicAllocator());

	const PxU8* indices = pxMesh->getIndexBuffer();
	for (FDUint i = 0; i < polygonCount; i++) {
		PxHullPolygon polygon;
		FDbool success = pxMesh->getPolygonData(i, polygon);
		if (!success) {
			FD_THROW(GenericException("Failed to get polygon data.\n"));
		}

		FDUint firstIndex = 0;
		for (FDUint j = 0; j < polygon.mNbVerts; j++) {

			PxU8 cIndex = *(indices + polygon.mIndexBase + j);
			FDUint myIndex = author.newPoint(pxMesh->getVertices()[cIndex]);
			if (j == 0) {
				firstIndex = myIndex;
			}
		}

		for (FDUint j = 2; j < polygon.mNbVerts; j++) {
			FDUint i1 = firstIndex;
			FDUint i2 = firstIndex + j - 1;
			FDUint i3 = firstIndex + j;

			author.newTriangle(i1, i2, i3);
		}
	}

	author.postProcess();

	Mesh* mesh = graphicsSystem.getAPI().newMesh(author);
	return mesh;
}
コード例 #24
0
ファイル: audiofx_lv2.cpp プロジェクト: antorsae/ecasound
EFFECT_LV2::EFFECT_LV2 (Lilv::Plugin pdesc) throw(ECA_ERROR&) :plugin_desc(pdesc) 
{
  bool inplacebroken=plugin_desc.has_feature(ECA_LV2_WORLD::InPlaceBrokenNode());
  if (inplacebroken) {
    throw(ECA_ERROR("AUDIOFX_LV2", "Inplace-broken plugins not supported."));
  }
  /* FIXME: strip linefeeds and other forbidden characters; write down to
   *        to ECA_OBJECT docs what chars are allowed and what are not... */
  Lilv::Node name(plugin_desc.get_name());
  name_rep = string(name.as_string());
  unique_rep = string(plugin_desc.get_uri().as_string());
  Lilv::Node author(plugin_desc.get_author_name());
  if(author) {
    maker_rep = string(author.as_string());
  } else {
    maker_rep = string();
  }
  buffer_repp = 0;
  init_ports();
}
コード例 #25
0
ファイル: wmwidget.cpp プロジェクト: kratuna/kipi-plugins
QMap <QString,QMap <QString,QString> > WmWidget::allImagesDesc()
{

    KUrl::List urls = m_imgList->imageUrls(false);


    for (int i = 0; i < urls.size(); ++i)
    {

        QMap<QString, QString> imageMetaData = m_imagesDescInfo[urls.at(i).path()];

            imageMetaData["author"] = author();
            imageMetaData["license"] = license();

        m_imagesDescInfo[urls.at(i).path()]=imageMetaData;

    }

    return m_imagesDescInfo;
}
コード例 #26
0
void WordSchemaSoftDiscoverStrategy::CacheRevisionAuthors()
{
	LOG_WS_FUNCTION_SCOPE();
   try
   {
      WrdStringWithDataTypedTable wrdStringWithDataTypedTable;
      wrdStringWithDataTypedTable.setType(STRING_WITH_DATA_TABLE_TYPE_REVISION_AUTHORS);
      m_pReader->read(wrdStringWithDataTypedTable);

      const WrdStringWithDataTable& wrdStringWithDataTable = wrdStringWithDataTypedTable.getStringTable();
      for (ChUINT2 index = 0; index < wrdStringWithDataTable.getNumberOfStrings(); ++index)
      {
         _bstr_t author(wrdStringWithDataTable.getStringData(index).m_string.c_str());
         m_RevisionAuthors.insert(INT2BSTR::value_type(index, author));
      }
   }
   catch(CsException const& /*e*/)
   {
      throw Workshare::Exception(_T("Binary Document Library threw an exception"));
   }
}
コード例 #27
0
ファイル: film_genie.c プロジェクト: eokeeffe/C-code
void options()//show the options
{
	int user_choice;
	clear_screen();
	fflush(stdin);
	printf("Welcome to Film Genie version 1.0\r\n");
	printf("Please input a number for the option\r\n");
	printf("1.Play Film Genie\r\n");
	printf("2.Help\r\n");
	printf("3.Author\r\n");
	printf("4.Exit\r\n");
	scanf("%d",&user_choice);
	dummy=getchar();
	if(user_choice==1){read_file();}
	if(user_choice==2){help();}
	if(user_choice==3){author();}
	if(user_choice==4){end_all();}
	if(user_choice==5){read_out();}//mainly for diagnostics on the file
	else
	{printf("Please try again with a number specified\r\n");wait_for_user();options();}

}
コード例 #28
0
not_null<PeerData*> HistoryMessage::displayFrom() const {
	return history()->peer->isSelf()
		? senderOriginal()
		: author();
}
コード例 #29
0
ファイル: svn.cpp プロジェクト: obarthel/Gource
bool SVNCommitLog::parseCommit(RCommit& commit) {

    //fprintf(stderr,"parsing svn log\n");

    std::string line;

    if(!getNextLine(line)) return false;

    //start of log entry
    if(!svn_logentry_start.match(line)) {

        //is this the start of the document
        if(!svn_xml_tag.match(line)) return false;

        //fprintf(stderr,"found xml tag\n");

        //if so find the first logentry tag

        bool found_logentry = false;

        while(getNextLine(line)) {
            if(svn_logentry_start.match(line)) {
                found_logentry = true;
                break;
            }
        }

        if(!found_logentry) return false;
    }

    //fprintf(stderr,"found logentry\n");

    logentry.clear();

    logentry.append(line);
    logentry.append("\n");

    //fprintf(stderr,"found opening tag\n");

    bool endfound = false;

    while(getNextLine(line)) {
        logentry.append(line);
        logentry.append("\n");
        if(svn_logentry_end.match(line)) {
            //fprintf(stderr,"found closing tag\n");
            endfound=true;
            break;
        }
    }

    //incomplete commit
    if(!endfound) return false;

    //fprintf(stderr,"read logentry\n");

    TiXmlDocument doc;

    if(!doc.Parse(logentry.c_str())) return false;

    //fprintf(stderr,"try to parse logentry: %s\n", logentry.c_str());

    TiXmlElement* leE = doc.FirstChildElement( "logentry" );

    std::vector<std::string> entries;

    if(!leE) return false;

    //parse date
    TiXmlElement* dateE = leE->FirstChildElement( "date" );

    if(!dateE) return false;

    std::string timestamp_str(dateE->GetText());

    if(!svn_logentry_timestamp.match(timestamp_str, &entries))
        return false;

    struct tm time_str;

    time_str.tm_year  = atoi(entries[0].c_str()) - 1900;
    time_str.tm_mon   = atoi(entries[1].c_str()) - 1;
    time_str.tm_mday  = atoi(entries[2].c_str());
    time_str.tm_hour  = atoi(entries[3].c_str());
    time_str.tm_min   = atoi(entries[4].c_str());
    time_str.tm_sec   = atoi(entries[5].c_str());
    time_str.tm_isdst = -1;

#ifdef HAVE_TIMEGM
    commit.timestamp = timegm(&time_str);
#else
    commit.timestamp = __timegm_hack(&time_str);
#endif

    //parse author
    TiXmlElement* authorE = leE->FirstChildElement("author");

    if(authorE != 0) {
		// GetText() may return NULL, causing author instantiation to crash.
        std::string author(authorE->GetText() ? authorE->GetText() : "Unknown");

        if(author.empty()) author = "Unknown";

        commit.username = author;
    }

    TiXmlElement* pathsE = leE->FirstChildElement( "paths" );

    //log entries sometimes dont have any paths
    if(!pathsE) return true;

    //parse changes

    for(TiXmlElement* pathE = pathsE->FirstChildElement("path"); pathE != 0; pathE = pathE->NextSiblingElement()) {
        //parse path

        const char* kind   = pathE->Attribute("kind");
        const char* action = pathE->Attribute("action");

        //check for action
        if(action == 0) continue;

        bool is_dir = false;

        //if has the 'kind' attribute (old versions of svn dont have this), check if it is a dir
        if(kind != 0 && strcmp(kind,"dir") == 0) {

            //accept only deletes for directories
            if(strcmp(action, "D") != 0) continue;

            is_dir = true;
        }

        std::string file(pathE->GetText());
        std::string status(action);

        if(file.empty()) continue;
        if(status.empty()) continue;

        //append trailing slash if is directory
        if(is_dir && file[file.size()-1] != '/') {
            file = file + std::string("/");
        }

        commit.addFile(file, status);
    }

    //fprintf(stderr,"parsed logentry\n");

    //read files

    return true;
}
コード例 #30
0
void
CSDReader::softpkg (DOMElement* element)
throw(CSDReadException)
{
	if ( !package_ ) abort();
	std::string element_name;
    DOMNode* child = element->getFirstChild();
	while (child != 0)
	{
		if (child->getNodeType() == DOMNode::ELEMENT_NODE)
		{
			element_name = Qedo::transcode(child->getNodeName());

			//
			// title
			//
			if (element_name == "title")
			{
				title((DOMElement*)child);
			}

			//
			// pkgtype
			//
			else if (element_name == "pkgtype")
			{
				pkgtype((DOMElement*)child);
			}

			//
			// repository
			//
			else if (element_name == "repository")
			{
				// TODO
			}

			//
			// author
			//
			else if (element_name == "author")
			{
				author((DOMElement*)child);
			}

			//
			// description
			//
			else if (element_name == "description")
			{
				description((DOMElement*)child);
			}

			//
			// license
			//
			else if (element_name == "license")
			{
				license((DOMElement*)child);
			}

			//
			// idl
			//
			else if (element_name == "idl")
			{
				idl((DOMElement*)child);
			}

			//
			// propertyfile
			//
			else if (element_name == "propertyfile")
			{
				propertyfile((DOMElement*)child);
			}

			//
			// dependency
			//
			else if (element_name == "dependency")
			{
				dependency((DOMElement*)child);
			}

			//
			// extension
			//
			else if (element_name == "extension")
			{
				extension((DOMElement*)child);
			}
		}

		// get next child
		child = child->getNextSibling();
    }

	DOMNodeList* nodeList;
	DOMElement* elem;
	unsigned int len = 0;
	unsigned int i = 0;
	std::string uuid = data_->uuid;

    //
	// implementation
	//
	nodeList = element->getElementsByTagName(X("implementation"));
	len = nodeList->getLength();
	bool impl_found = false;
    for (i = 0; i < len; ++i)
    {
		elem = (DOMElement*)(nodeList->item(i));
		if (!XMLString::compareString(elem->getAttribute(X("id")), X(uuid.c_str())))
		{
			impl_found = true;
			break;
		}
    }
	if(impl_found)
	{
		implementation(elem);
	}
	else
	{
		NORMAL_ERR3( "CSDReader: implementation for ", uuid, " missing!" );
		throw CSDReadException();
	}

    //
	// corba component descriptor
	//
    if (ccd_file_.empty())
    {
		nodeList = element->getElementsByTagName(X("descriptor"));
		len = nodeList->getLength();
		if(len == 1)
		{
			ccd_file_ = descriptor((DOMElement*)(nodeList->item(0)));
		}
		else if(len > 1)
		{
			NORMAL_ERR( "CSDReader: multiple descriptor elements!" );
		}

		if (ccd_file_.empty())
        {
			NORMAL_ERR2( "CSDReader: missing component descriptor for ", uuid );
	        throw CSDReadException();
        }
    }
	//
	// parse the corba component descriptor file
    //
	CCDReader reader( path_ + ccd_file_, path_ );
	reader.readCCD( &(data_->component), package_ );
}