Click here to Skip to main content
15,896,118 members
Articles / Desktop Programming / MFC

Be Sweet - a set of visual source code browsers

Rate me:
Please Sign up or sign in to vote.
4.85/5 (35 votes)
1 Jul 20038 min read 184.4K   4.9K   122  
A set of source code and project browsers to compliment Visual Studio.
/**
/*   Copyright (c) 2003by  Marco Welti
/*
/*   This document is  bound by the  QT Public License
/*   (http://www.trolltech.com/licenses/qpl.html).
/*   See License.txt for more information.
/*
/*
/*
/*   ALL RIGHTS RESERVED.  
/* 
/*   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
/*   OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
/*   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
/*   ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
/*   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
/*   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
/*   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
/*   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
/*   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
/*   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
/*   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* 
/***********************************************************************/

#ifndef ESBServerXX_H
#define ESBServerXX_H

#include "smart_ptr.h"

#include "ESBServerCtrlPanel.h"

#include <Controller/Browsers/OutlineBrowser.h>
#include <Controller/Browsers/HierarchyBrowser.h>
#include <Controller/Browsers/TypeBrowser.h>
#include <Controller/Browsers/WorkspaceBrowser.h>

#include "Workspace.h"

#include "CTagsDatabase.h"
#include "CTagsTypeInfoLoader.h"
#include "CTagsMethodLoader.h"
#include "CTagsFileOutlineLoader.h"

class ESBServer
{
private:
  class EditorHandler : public DefaultSingleSelectionListener, public TagSelectionListener
  {
  private:
    ESBServer *mOuter;
  public:
    EditorHandler(ESBServer *outer) : mOuter(outer){};
    void selectionChanged(const ScopedNameBrowserItem&);
    void gotoFile(const TagLocation &) const;
  };
  friend class EditorHandler;

private:
  std::string mName;
  
  ESBServerControlPanel mRenderer;
  OutlineBrowser  mOutlineBrowser[2];
  HierarchyBrowser  mHierarchyBrowser;
  TagBrowser     mTypeBrowser;
  TagBrowser     mMethodBrowser;
  WorkspaceBrowser mWorkspaceBrowser;
  
  smart_ptr<Workspace> mWorkspace;
  smart_ptr<EditorBroker> mEditorBroker;


public:
  ESBServer(const std::string &wsname);
  ~ESBServer();

  void showFileOutline(const std::string&, bool enforceModelReload = false);
  void showHierarchy(const Inheritable&);
  void showTypes();
  void showMethods();
  void showWorkspace();
  void showBrowser(const std::string&, const std::string&);

  void reparseFile(const std::string&);
  void reparseWorkspace();
  void openWorkspace(const Workspace&);

  CWnd* getRenderer() { return &mRenderer; };
  void run();

  const std::string& getName() { return mName; };

  void setEditorBroker(smart_ptr<EditorBroker> eb) { mEditorBroker = eb; };
  EditorBroker&  getEditorBroker() { return *mEditorBroker; }
  
private:
  void showOutline(const std::string&);
  void showHierarchy(const std::string&);
  smart_ptr<CppType> getType(const std::string&);
  
  OutlineBrowser& getFileOutlineBrowser() { return mOutlineBrowser[0]; }
  OutlineBrowser& getTypeOutlineBrowser() { return mOutlineBrowser[1]; }
  HierarchyBrowser& getHierarchyBrowser() { return mHierarchyBrowser; }
  TagBrowser& getTypeBrowser() { return mTypeBrowser; }
  TagBrowser& getMethodBrowser() { return mMethodBrowser; }
  WorkspaceBrowser& getWorkspaceBrowser() { return mWorkspaceBrowser; }

  void setWorkspace(const smart_ptr<Workspace> &w) { mWorkspace = w; }
  smart_ptr<Workspace> getWorkspace() { return mWorkspace; }

  
  smart_ptr<TypeInfoLoader> getTypeInfoLoader();
  smart_ptr<MethodLoader> getMethodLoader();
  smart_ptr<FileOutlineLoader> getFileOutlineLoader();

};

#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Switzerland Switzerland
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions