Engauge Digitizer  2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
ExportToClipboard Class Reference

Strategy class for exporting to the clipboard. This strategy is external to the Document class so that class is simpler. More...

#include <ExportToClipboard.h>

Collaboration diagram for ExportToClipboard:
Collaboration graph

Public Member Functions

 ExportToClipboard ()
 Single constructor. More...
 
void exportToClipboard (const QStringList &selected, const Transformation &transformation, QTextStream &strCsv, QTextStream &strHtml, const Curve &curveAxis, const CurvesGraphs &curvesGraphsAll, CurvesGraphs &curvesGraphsSelected) const
 Export, curve-by-curve, raw data points to a string that will be copied to the clipboard. More...
 

Detailed Description

Strategy class for exporting to the clipboard. This strategy is external to the Document class so that class is simpler.

Definition at line 18 of file ExportToClipboard.h.

Constructor & Destructor Documentation

ExportToClipboard::ExportToClipboard ( )

Single constructor.

Definition at line 14 of file ExportToClipboard.cpp.

15 {
16 }

Member Function Documentation

void ExportToClipboard::exportToClipboard ( const QStringList &  selected,
const Transformation transformation,
QTextStream &  strCsv,
QTextStream &  strHtml,
const Curve curveAxis,
const CurvesGraphs curvesGraphsAll,
CurvesGraphs curvesGraphsSelected 
) const

Export, curve-by-curve, raw data points to a string that will be copied to the clipboard.

Parameters
[in]selectedSimple list of selected points that will be exported
[in]transformationTransformation which may or may not be defined
[out]strCsvSelected points as comma separated value list
[out]strHtmlSelected points as html
[in]curveAxisAxis curve in the Document and its points
[in]curvesGraphsAllAll graph curves in the Document and their points
[out]curvesGraphsSelectedSelected points as a subset of document.curvesGraphs()

Definition at line 18 of file ExportToClipboard.cpp.

25 {
26  // For speed, build a hash as a fast lookup table
27  QHash<QString, bool> selectedHash;
28  QStringList::const_iterator itrH;
29  for (itrH = selected.begin (); itrH != selected.end (); itrH++) {
30  QString pointIdentifier = *itrH;
31  selectedHash [pointIdentifier] = false;
32  }
33 
34  // List of curve names. Although we do not want axis points to be exported to the real
35  // clipboard, leaving out the axis curve would result in axis points not getting
36  // deleted. So we include the axis curve
37  QStringList curveNames = curvesGraphsAll.curvesGraphsNames();
38  curveNames << AXIS_CURVE_NAME;
39 
40  // Export
41  QStringList::const_iterator itrC;
42  for (itrC = curveNames.begin(); itrC != curveNames.end (); itrC++) {
43 
44  QString curveName = *itrC;
45  if (curveName == AXIS_CURVE_NAME) {
46  curveAxis.exportToClipboard (selectedHash,
47  transformation,
48  strCsv,
49  strHtml,
50  curvesGraphsSelected);
51  } else {
52  const Curve *curve = curvesGraphsAll.curveForCurveName(curveName);
53  ENGAUGE_CHECK_PTR (curve);
54  curve->exportToClipboard (selectedHash,
55  transformation,
56  strCsv,
57  strHtml,
58  curvesGraphsSelected);
59  }
60  }
61 }
void exportToClipboard(const QHash< QString, bool > &selectedHash, const Transformation &transformation, QTextStream &strCsv, QTextStream &strHtml, CurvesGraphs &curvesGraphs) const
Export points in this Curve found in the specified point list.
Definition: Curve.cpp:220
Curve * curveForCurveName(const QString &curveName)
Return the axis or graph curve for the specified curve name.
#define ENGAUGE_CHECK_PTR(ptr)
#endif
Definition: EngaugeAssert.h:27
Container for one set of digitized Points.
Definition: Curve.h:33
QStringList curvesGraphsNames() const
List of graph curve names.
const QString AXIS_CURVE_NAME

The documentation for this class was generated from the following files: