void ClangEditorDocumentProcessor::updateCodeWarnings(const QVector<ClangBackEnd::DiagnosticContainer> &diagnostics,
                                                      uint documentRevision)
{
    if (documentRevision == revision()) {
        const auto codeWarnings = generateDiagnosticHints(diagnostics);
        emit codeWarningsUpdated(revision(), codeWarnings);
    }
}
void ClangEditorDocumentProcessor::updateCodeWarnings(const QVector<ClangBackEnd::DiagnosticContainer> &diagnostics,
                                                      uint documentRevision)
{
    if (documentRevision == revision()) {
        m_diagnosticManager.processNewDiagnostics(diagnostics);
        const auto codeWarnings = m_diagnosticManager.takeExtraSelections();
        emit codeWarningsUpdated(revision(), codeWarnings);
    }
}
Ejemplo n.º 3
0
QString Property::qPropertyString() const
{
    QString str;
    str = QString("Q_PROPERTY(%1 %2")
          .arg(realTypeName())
          .arg(replaceFisrtLetterToLower(m_d->p_name));
#define AddBoolProperty(MEMBER, MARCO, QTNAME) \
    if (MEMBER() != PropertyDefault##MARCO) \
    { \
    str += QString(" ") + #QTNAME + QString(" ") \
    + ((MEMBER()) ? "true" : "false"); \
}
    if (member())
    {
        str += QString(" MEMBER ") + memberVariableName();
    }
    if (read())
    {
        str += QString(" READ ") + readFunctionName();
    }
    if (write())
    {
        str += QString(" WRITE ") + writeFunctionName();
    }
    if (reset())
    {
        str += QString(" RESET ") + resetFunctionName();
    }
    if (notify())
    {
        str += QString(" NOTIFY ") + signalName();
    }
    if (revision() != PropertyDefaultRevision)
    {
        str += QString(" REVISION %1").arg(revision());
    }
    AddBoolProperty(designable, Designable, DESIGNABLE);
    AddBoolProperty(scriptable, Scriptable, SCRIPTABLE);
    AddBoolProperty(stored, Stored, STORED);
    AddBoolProperty(user, User, USER);
    if (constant() != PropertyDefaultConstant)
    {
        str += QString(" CONSTANT");
    }
    if (final() != PropertyDefaultFinal)
    {
        str += QString(" FINAL");
    }
    str += QString(")");
    return str;
}
void ClangEditorDocumentProcessor::onParserFinished()
{
    if (revision() != m_parserRevision)
        return;

    // Emit ifdefed out blocks
    const auto ifdefoutBlocks = toTextEditorBlocks(m_parser->ifdefedOutBlocks());
    emit ifdefedOutBlocksUpdated(revision(), ifdefoutBlocks);

    // Run semantic highlighter
    m_semanticHighlighter.run();

    updateProjectPartAndTranslationUnitForEditor();
}
Ejemplo n.º 5
0
void TextHistory::transformCursor(int &line, int &column, KTextEditor::MovingCursor::InsertBehavior insertBehavior, qint64 fromRevision, qint64 toRevision)
{
    /**
     * -1 special meaning for from/toRevision
     */
    if (fromRevision == -1) {
        fromRevision = revision();
    }

    if (toRevision == -1) {
        toRevision = revision();
    }

    /**
     * shortcut, same revision
     */
    if (fromRevision == toRevision) {
        return;
    }

    /**
     * some invariants must hold
     */
    Q_ASSERT(!m_historyEntries.empty());
    Q_ASSERT(fromRevision != toRevision);
    Q_ASSERT(fromRevision >= m_firstHistoryEntryRevision);
    Q_ASSERT(fromRevision < (m_firstHistoryEntryRevision + m_historyEntries.size()));
    Q_ASSERT(toRevision >= m_firstHistoryEntryRevision);
    Q_ASSERT(toRevision < (m_firstHistoryEntryRevision + m_historyEntries.size()));

    /**
     * transform cursor
     */
    bool moveOnInsert = insertBehavior == KTextEditor::MovingCursor::MoveOnInsert;

    /**
     * forward or reverse transform?
     */
    if (toRevision > fromRevision) {
        for (int rev = fromRevision - m_firstHistoryEntryRevision + 1; rev <= (toRevision - m_firstHistoryEntryRevision); ++rev) {
            const Entry &entry = m_historyEntries.at(rev);
            entry.transformCursor(line, column, moveOnInsert);
        }
    } else {
        for (int rev = fromRevision - m_firstHistoryEntryRevision; rev >= (toRevision - m_firstHistoryEntryRevision + 1); --rev) {
            const Entry &entry = m_historyEntries.at(rev);
            entry.reverseTransformCursor(line, column, moveOnInsert);
        }
    }
}
Ejemplo n.º 6
0
void TextHistory::addEntry(const Entry &entry)
{
    /**
     * history should never be empty
     */
    Q_ASSERT(!m_historyEntries.empty());

    /**
     * simple efficient check: if we only have one entry, and the entry is not referenced
     * just replace it with the new one and adjust the revision
     */
    if ((m_historyEntries.size() == 1) && !m_historyEntries.first().referenceCounter) {
        /**
         * remember new revision for first element, it is the revision we get after this change
         */
        m_firstHistoryEntryRevision = revision() + 1;

        /**
         * remember edit
         */
        m_historyEntries.first() = entry;

        /**
         * be done...
         */
        return;
    }

    /**
     * ok, we have more than one entry or the entry is referenced, just add up new entries
     */
    m_historyEntries.push_back(entry);
}
Ejemplo n.º 7
0
bool WaveMetaDocument::addDocument(WaveDocument* wdoc)
{
    // Strip the "_" in front.
    QString docid = wdoc->documentId().mid(1);

    ObjectMutation rootop(true);
    if ( !jsonObject().hasAttribute("documents"))
    {
        JSONObject documentsOp(true);
        documentsOp.setAttribute(docid, JSONObject(true));
        rootop.setMutation("documents", documentsOp);
    }
    else
    {
        ObjectMutation documentsOp(true);
        documentsOp.setMutation(docid, InsertMutation(JSONObject(true)));
        rootop.setMutation("documents", documentsOp);
    }
    DocumentMutation docop(rootop);
    docop.setDocumentId(documentId());
    docop.setRevision(revision());

    qDebug("OP=%s", qPrintable(docop.mutation().toJSON()));

    JSONObject result = container()->put(docop.mutation().toObject(), documentId());
    return result.attribute("ok").toBool();
}
Ejemplo n.º 8
0
/* return TRUE if OK */
bool
gs_load_dll(const char * szDllName)
{

	// long version;
    hmodule = LoadLibrary(szDllName);
    if (hmodule < (HINSTANCE)HINSTANCE_ERROR) {
		/* fprintf(stderr,"loading  %s failed\n", szDllName); */
		return false;
	}

	// fprintf(stderr, "loaded %s\n", szDllName);

    /* DLL is now loaded */
    /* Get pointers to functions */

//TODO    if ( (gsapi.revision = (PFN_gsdll_revision) GetProcAddress(gsapi.hmodule, "gsdll_revision")) == NULL)
//TODO	return gs_load_dll_cleanup();
	
#ifdef GS_REVISION
    /* check DLL version  [OPTIONAL] */
    revision(NULL, NULL, &version, NULL);
    if (version != (long)GS_REVISION) {
	sprinft(messagebuffer,"Wrong version of DLL found.\n  Found version %ld\n\
  Need version  %ld\n", version, (long)GS_REVISION);
	write_message();
	return gs_load_dll_cleanup();
    }
JNIEXPORT jbyteArray JNICALL
Java_org_apache_subversion_javahl_SVNClient_revProperty
(JNIEnv *env, jobject jthis, jstring jpath, jstring jname, jobject jrevision)
{
  JNIEntry(SVNClient, revProperty);
  SVNClient *cl = SVNClient::getCppObject(jthis);
  if (cl == NULL)
    {
      JNIUtil::throwError(_("bad C++ this"));
      return NULL;
    }
  JNIStringHolder path(jpath);
  if (JNIUtil::isExceptionThrown())
    return NULL;

  JNIStringHolder name(jname);
  if (JNIUtil::isExceptionThrown())
    return NULL;

  Revision revision(jrevision);
  if (JNIUtil::isExceptionThrown())
    return NULL;

  return cl->revProperty(path, name, revision);
}
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_properties
(JNIEnv *env, jobject jthis, jstring jpath, jobject jrevision,
 jobject jpegRevision, jobject jdepth, jobject jchangelists,
 jobject jproplistCallback)
{
  JNIEntry(SVNClient, properties);
  SVNClient *cl = SVNClient::getCppObject(jthis);
  if (cl == NULL)
    {
      JNIUtil::throwError(_("bad C++ this"));
      return;
    }
  JNIStringHolder path(jpath);
  if (JNIUtil::isExceptionThrown())
    return;

  Revision revision(jrevision);
  if (JNIUtil::isExceptionThrown())
    return;

  Revision pegRevision(jpegRevision);
  if (JNIUtil::isExceptionThrown())
    return;

  StringArray changelists(jchangelists);
  if (JNIUtil::isExceptionThrown())
    return;

  ProplistCallback callback(jproplistCallback);
  cl->properties(path, revision, pegRevision, EnumMapper::toDepth(jdepth),
                 changelists, &callback);
}
JNIEXPORT jlongArray JNICALL
Java_org_apache_subversion_javahl_SVNClient_update
(JNIEnv *env, jobject jthis, jobject jtargets, jobject jrevision,
 jobject jdepth, jboolean jdepthIsSticky, jboolean jmakeParents,
 jboolean jignoreExternals, jboolean jallowUnverObstructions)
{
  JNIEntry(SVNClient, update);
  SVNClient *cl = SVNClient::getCppObject(jthis);
  if (cl == NULL)
    {
      JNIUtil::throwError(_("bad C++ this"));
      return NULL;
    }
  Revision revision(jrevision);
  if (JNIUtil::isExceptionThrown())
    return NULL;

  SVN::Pool tmpPool;
  StringArray targetsArr(jtargets);
  Targets targets(targetsArr, tmpPool);
  if (JNIUtil::isExceptionThrown())
    return NULL;

  return cl->update(targets, revision, EnumMapper::toDepth(jdepth),
                    jdepthIsSticky ? true : false,
                    jmakeParents ? true : false,
                    jignoreExternals ? true : false,
                    jallowUnverObstructions ? true : false);
}
JNIEXPORT jlong JNICALL
Java_org_apache_subversion_javahl_SVNClient_checkout
(JNIEnv *env, jobject jthis, jstring jmoduleName, jstring jdestPath,
 jobject jrevision, jobject jpegRevision, jobject jdepth,
 jboolean jignoreExternals, jboolean jallowUnverObstructions)
{
  JNIEntry(SVNClient, checkout);
  SVNClient *cl = SVNClient::getCppObject(jthis);
  if (cl == NULL)
    {
      JNIUtil::throwError(_("bad C++ this"));
      return -1;
    }
  Revision revision(jrevision, true);
  if (JNIUtil::isExceptionThrown())
    return -1;

  Revision pegRevision(jpegRevision, true);
  if (JNIUtil::isExceptionThrown())
    return -1;

  JNIStringHolder moduleName(jmoduleName);
  if (JNIUtil::isExceptionThrown())
    return -1;

  JNIStringHolder destPath(jdestPath);
  if (JNIUtil::isExceptionThrown())
    return -1;

  return cl->checkout(moduleName, destPath, revision, pegRevision,
                      EnumMapper::toDepth(jdepth),
                      jignoreExternals ? true : false,
                      jallowUnverObstructions ? true : false);
}
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_list
(JNIEnv *env, jobject jthis, jstring jurl, jobject jrevision,
 jobject jpegRevision, jobject jdepth, jint jdirentFields,
 jboolean jfetchLocks, jobject jcallback)
{
  JNIEntry(SVNClient, list);
  SVNClient *cl = SVNClient::getCppObject(jthis);
  if (cl == NULL)
    return;

  JNIStringHolder url(jurl);
  if (JNIUtil::isExceptionThrown())
    return;

  Revision revision(jrevision);
  if (JNIUtil::isExceptionThrown())
    return;

  Revision pegRevision(jpegRevision);
  if (JNIUtil::isExceptionThrown())
    return;

  ListCallback callback(jcallback);
  cl->list(url, revision, pegRevision, EnumMapper::toDepth(jdepth),
           (int)jdirentFields, jfetchLocks ? true : false, &callback);
}
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_streamFileContent
(JNIEnv *env, jobject jthis, jstring jpath, jobject jrevision,
 jobject jpegRevision, jobject jstream)
{
  JNIEntry(SVNClient, streamFileContent);
  SVNClient *cl = SVNClient::getCppObject(jthis);
  if (cl == NULL)
    {
      JNIUtil::throwError(_("bad C++ this"));
      return;
    }
  JNIStringHolder path(jpath);
  if (JNIUtil::isExceptionThrown())
    return;

  Revision revision(jrevision);
  if (JNIUtil::isExceptionThrown())
    return;

  Revision pegRevision(jpegRevision);
  if (JNIUtil::isExceptionThrown())
    return;

  OutputStream dataOut(jstream);
  if (JNIUtil::isExceptionThrown())
    return;

  cl->streamFileContent(path, revision, pegRevision, dataOut);
}
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_setRevProperty
(JNIEnv *env, jobject jthis, jstring jpath, jstring jname, jobject jrevision,
 jstring jval, jstring joriginalValue, jboolean jforce)
{
  JNIEntry(SVNClient, setRevProperty);
  SVNClient *cl = SVNClient::getCppObject(jthis);
  if (cl == NULL)
    {
      JNIUtil::throwError(_("bad C++ this"));
      return;
    }
  JNIStringHolder path(jpath);
  if (JNIUtil::isExceptionThrown())
    return;

  JNIStringHolder name(jname);
  if (JNIUtil::isExceptionThrown())
    return;

  Revision revision(jrevision);
  if (JNIUtil::isExceptionThrown())
    return;

  JNIStringHolder value(jval);
  if (JNIUtil::isExceptionThrown())
    return;

  JNIStringHolder original_value(joriginalValue);
  if (JNIUtil::isExceptionThrown())
    return;

  cl->setRevProperty(path, name, revision, value, original_value,
                     jforce ? true: false);
}
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNRepos_setRevProp
(JNIEnv *env, jobject jthis, jobject jpath, jobject jrevision,
 jstring jpropName, jstring jpropValue, jboolean jusePreRevPropChangeHook,
 jboolean jusePostRevPropChangeHook)
{
  JNIEntry(SVNRepos, setRevProp);
  SVNRepos *cl = SVNRepos::getCppObject(jthis);
  if (cl == NULL)
    {
      JNIUtil::throwError(_("bad C++ this"));
      return;
    }

  File path(jpath);
  if (JNIUtil::isExceptionThrown())
    return;

  Revision revision(jrevision);
  if (JNIUtil::isExceptionThrown())
    return;

  JNIStringHolder propName(jpropName);
  if (JNIUtil::isExceptionThrown())
    return;

  JNIStringHolder propValue(jpropValue);
  if (JNIUtil::isExceptionThrown())
    return;

  cl->setRevProp(path, revision, propName, propValue,
                 jusePreRevPropChangeHook ? true : false,
                 jusePostRevPropChangeHook ? true : false);
}
Ejemplo n.º 17
0
bool WaveMetaDocument::addContainer(WaveContainer* c)
{
    Q_ASSERT(container() == c->parentContainer());

    ObjectMutation rootop(true);
    if ( !jsonObject().hasAttribute("containers"))
    {
        JSONObject documentsOp(true);
        documentsOp.setAttribute(c->name(), JSONObject(true));
        rootop.setMutation("containers", documentsOp);
    }
    else
    {
        ObjectMutation documentsOp(true);
        documentsOp.setMutation(c->name(), InsertMutation(JSONObject(true)));
        rootop.setMutation("containers", documentsOp);
    }
    DocumentMutation docop(rootop);
    docop.setDocumentId(documentId());
    docop.setRevision(revision());

    // qDebug("OP=%s", qPrintable(docop.mutation().toJSON()));

    JSONObject result = container()->put(docop.mutation().toObject(), documentId());
    return result.attribute("ok").toBool();
}
void ClangEditorDocumentProcessor::onParserFinished()
{
    if (revision() != m_parserRevision)
        return;

    updateProjectPartAndTranslationUnitForEditor();
}
Ejemplo n.º 19
0
Archivo: file.cpp Proyecto: an146/vomid
void
File::redo()
{
	if (FileRevision *next = revision()->next()) {
		update(next);
		emit acted();
	}
}
Ejemplo n.º 20
0
Archivo: file.cpp Proyecto: an146/vomid
void
File::undo()
{
	if (FileRevision *prev = revision()->prev()) {
		update(prev);
		emit acted();
	}
}
Ejemplo n.º 21
0
revision convert(const svn_opt_revision_t& rev)
{
  switch (rev.kind)
    {
    case svn_opt_revision_number:
      return revision(revision::number(rev.value.number));
    case svn_opt_revision_date:
      {
        // NOTE: We're assuming that the APR and C++ system_clock epochs
        //       are the same. This will be standardized in C++20.
        using usec = revision::usec;
        return revision(revision::time<usec>(usec{rev.value.date}));
      }
    default:
      return revision(convert(rev.kind));
    }
}
ClangBackEnd::FileContainer
ClangEditorDocumentProcessor::fileContainerWithDocumentContent(const QString &projectpartId) const
{
    return ClangBackEnd::FileContainer(filePath(),
                                       projectpartId,
                                       textDocument()->toPlainText(),
                                       true,
                                       revision());
}
ClangBackEnd::FileContainer
ClangEditorDocumentProcessor::fileContainerWithArguments(CppTools::ProjectPart *projectPart) const
{
    const auto projectPartId = projectPart
            ? Utf8String::fromString(projectPart->id())
            : Utf8String();
    const QStringList theFileArguments = fileArguments(filePath(), projectPart);

    return {filePath(), projectPartId, Utf8StringVector(theFileArguments), revision()};
}
Ejemplo n.º 24
0
QList<QMetaProperty> Pref::defaultRestoreProperties() {
	QList<QMetaProperty> list;
	auto &mo = MrlState::staticMetaObject;
	const int count = mo.propertyCount();
	for (int i=mo.propertyOffset(); i<count; ++i) {
		const auto property = mo.property(i);
		if (property.revision())
			list.append(property);
	}
	return list;
}
Ejemplo n.º 25
0
const wxString mmex::getProgramVersion()
{
    wxString revision(MMEX_REVISION_ID);
    revision.Replace("$", wxEmptyString);

/**************************************************
 Refer to comments in the file: constants.h
 **************************************************/
#ifndef _MM_EX_BUILD_TYPE_RELEASE
    revision.Replace("Rev: ", "DEV:SVN-");
#endif

    revision.Trim();
    return wxString::Format("1.1.0.0  %s", revision);
}
Ejemplo n.º 26
0
int KMobileGnokii::readNote( int index, QString &note )
{
  // index is zero-based, and we only have one simulated note
  if (index<0 || index>=numNotes())
    return KIO::ERR_DOES_NOT_EXIST;

  note = QString("NOTE #%1\n"
		 "--------\n"
	"This is a sample note #%2\n\n"
	"DeviceClassName: %3\n"
	"Device Driver  : %4\n"
	"Device Revision: %5\n")
	.arg(index).arg(index)
	.arg(deviceClassName()).arg(deviceName()).arg(revision()); 
  return 0;
}
Ejemplo n.º 27
0
bool
UpdateAction::Perform()
{
  svn::Revision revision(svn::Revision::HEAD);
  // Did the user request a specific revision?:
  if (!m_data.useLatest)
  {
    TrimString(m_data.revision);
    if (!m_data.revision.IsEmpty())
    {
      svn_revnum_t revnum;
      m_data.revision.ToLong(&revnum, 10);  // If this fails, revnum is unchanged.
      revision = svn::Revision(revnum);
    }
  }

  const wxString & dir = Utf8ToLocal(GetPath().c_str());
  if (!dir.empty())
    wxSetWorkingDirectory(dir);
  svn::Client client(GetContext());

  svn_depth_t depth = svn_depth_unknown;
  switch (m_data.depth) {
  default:
  case UPDATE_WORKING_COPY:
    depth = svn_depth_unknown;
    break;
  case UPDATE_FULLY_RECURSIVE:
    depth = svn_depth_infinity;
    break;
  case UPDATE_IMMEDIATES:
    depth = svn_depth_immediates;
    break;
  case UPDATE_FILES:
    depth = svn_depth_files;
    break;
  case UPDATE_EMPTY:
    depth = svn_depth_empty;
    break;
  }

  client.update(GetTargets(), revision,
                depth, m_data.stickyDepth,
                m_data.ignoreExternals);

  return true;
}
void ClangEditorDocumentProcessor::updateHighlighting(
        const QVector<ClangBackEnd::HighlightingMarkContainer> &highlightingMarks,
        const QVector<ClangBackEnd::SourceRangeContainer> &skippedPreprocessorRanges,
        uint documentRevision)
{
    if (documentRevision == revision()) {
        const auto skippedPreprocessorBlocks = toTextEditorBlocks(textDocument(), skippedPreprocessorRanges);
        emit ifdefedOutBlocksUpdated(documentRevision, skippedPreprocessorBlocks);

        m_semanticHighlighter.setHighlightingRunner(
            [highlightingMarks]() {
                auto *reporter = new HighlightingMarksReporter(highlightingMarks);
                return reporter->start();
            });
        m_semanticHighlighter.run();
    }
}
Ejemplo n.º 29
0
QList<SM_Dropbox_FileInfo> SM_QDropbox::requestRevisionsAndWait(QString file, int max)
{
    clearError();
    requestRevisions(file, max, true);
    QList<SM_Dropbox_FileInfo> revisionList;

    if(errorState != SM_QDropbox::NoError || !_tempJson.isValid())
        return revisionList;

    QStringList responseList = _tempJson.getArray();
    for(int i=0; i<responseList.size(); ++i)
    {
        QString revData = responseList.at(i);
        SM_Dropbox_FileInfo revision(revData);
        revisionList.append(revision);
    }

    return revisionList;
}
void ClangEditorDocumentProcessor::run()
{
    updateTranslationUnitIfProjectPartExists();

    // Run clang parser
    disconnect(&m_parserWatcher, &QFutureWatcher<void>::finished,
               this, &ClangEditorDocumentProcessor::onParserFinished);
    m_parserWatcher.cancel();
    m_parserWatcher.setFuture(QFuture<void>());

    m_parserRevision = revision();
    connect(&m_parserWatcher, &QFutureWatcher<void>::finished,
            this, &ClangEditorDocumentProcessor::onParserFinished);
    const CppTools::WorkingCopy workingCopy = CppTools::CppModelManager::instance()->workingCopy();
    const QFuture<void> future = ::Utils::runAsync(&runParser, parser(), workingCopy);
    m_parserWatcher.setFuture(future);

    // Run builtin processor
    m_builtinProcessor.run();
}