1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
// copyright : (C) 2014 Eran Ifrah
// file name : dotwriter.h
//
// -------------------------------------------------------------------------
// A
// _____ _ _ _ _
// / __ \ | | | | (_) |
// | / \/ ___ __| | ___| | _| |_ ___
// | | / _ \ / _ |/ _ \ | | | __/ _ )
// | \__/\ (_) | (_| | __/ |___| | || __/
// \____/\___/ \__,_|\___\_____/_|\__\___|
//
// F i l e
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
/***************************************************************
* Name: dotwriter.h
* Purpose: Header to create writer to DOT language
* Author: Vaclav Sprucek
* Created: 2012-03-04
* Copyright: Vaclav Sprucek
* License: wxWidgets license (www.wxwidgets.org)
* Notes:
**************************************************************/
#include "lineparser.h"
#include "confcallgraph.h"
#include "plugin.h"
#include "static.h"
#include <wx/wx.h>
#include <wx/stream.h>
#include <wx/txtstrm.h>
#include <wx/dir.h>
#include <wx/filefn.h>
#include <wx/file.h>
/**
* @class DotWriter
* @brief Class write data from lineparser structure to dot language.
*/
class DotWriter
{
private:
wxString graph, end_graph, begin_graph;
wxString style, shape, fontname;
wxString cwhite, cblack;
wxString dlabel, dedge, hedge, hnode;
LineParserList *mlines;
wxString m_OutputString;
bool m_writedotfileFlag;
bool dwhideparams;
bool dwstripparams;
bool dwhidenamespaces;
int dwcn;
int dwce;
int dwtn;
int dwte;
protected:
/**
* @brief Object confData type ConfCallGraph with stored configuration data.
*/
ConfCallGraph confData;
/**
* @brief Get positions of STL template signs
* @param txt
* @param start
* @param end
* @return
*/
bool GetOuterTempleate(const wxString& txt, int *start, int *end);
public:
/**
* @brief Defautl constructor.
*/
DotWriter();
/**
* @brief Defautl destructor.
*/
~DotWriter();
/**
* @brief Function sets object DotWriter and assign the pointer pLines.
* @param pLines
*/
void SetLineParser(LineParserList *pLines);
/**
* @brief Function sets object DotWriter from stored configuration data.
* @param mgr
*/
void SetDotWriterFromDialogSettings(IManager *mgr);
/**
* @brief Function sets object DotWriter from given data.
* @param colnode
* @param coledge
* @param thrnode
* @param thredge
* @param hideparams
* @param stripparams
* @param hidenamespaces
*/
void SetDotWriterFromDetails(int colnode, int coledge, int thrnode, int thredge, bool hideparams, bool stripparams, bool hidenamespaces);
//
/**
* @brief Function create data in the DOT language and prepare it to write.
*/
void WriteToDotLanguage();
/**
* @brief Function write data in the DOT language to file dot.txt.
* @param path for file where write file with DOT language.
*/
bool SendToDotAppOutputDirectory(const wxString& path);
/**
* @brief Function return string modified by the options in the dialog settings of the plugin.
* @param name of the function stored in the list of objects.
*/
wxString OptionsShortNameAndParameters(const wxString& name);
/**
* @brief Function return string of color by the index value.
* @param index of the color, this value return function ReturnIndexForColor.
* */
wxString DefineColorForNodeEdge(int index);
/**
* @brief Function return string of color by the index value.
* @param index of the color, this value return function ReturnIndexForColor.
*/
wxString DefineColorForLabel(int index);
/**
* @brief Function return bool value if index is exist in the array.
* @param index of the function stored in the list of objects.
* @param array of index by nodes added to the call graph.
*/
bool IsInArray(int index, const wxArrayInt& array);
/**
* @brief Function return optimal index for color by the value time and options in the dialog settings of the plugin.
* @param time of the function stored in the list of objects.
* @param dwc is value from dialog settings node level colors
*/
int ReturnIndexForColor(float time, int dwc);
};
|