Engauge Digitizer 2
Public Member Functions | List of all members
CallbackDocumentScrub Class Reference

Callback for scrubbing Document. Any state error will be caught. More...

#include <CallbackDocumentScrub.h>

Collaboration diagram for CallbackDocumentScrub:
Collaboration graph

Public Member Functions

 CallbackDocumentScrub ()
 Single constructor. More...
 
QString badPointName () const
 Scrub result details. Applies when unsuccessful. More...
 
CallbackSearchReturn callback (const QString &curveName, const Point &point)
 Callback method. More...
 
bool success () const
 Scrub overall result. More...
 

Detailed Description

Callback for scrubbing Document. Any state error will be caught.

Definition at line 16 of file CallbackDocumentScrub.h.

Constructor & Destructor Documentation

◆ CallbackDocumentScrub()

CallbackDocumentScrub::CallbackDocumentScrub ( )

Single constructor.

Definition at line 14 of file CallbackDocumentScrub.cpp.

14 :
15 m_success (true)
16{
17}

Member Function Documentation

◆ badPointName()

QString CallbackDocumentScrub::badPointName ( ) const

Scrub result details. Applies when unsuccessful.

Definition at line 19 of file CallbackDocumentScrub.cpp.

20{
21 return m_badPointName;
22}

◆ callback()

CallbackSearchReturn CallbackDocumentScrub::callback ( const QString &  curveName,
const Point point 
)

Callback method.

Definition at line 24 of file CallbackDocumentScrub.cpp.

26{
27 QString identifier = point.identifier ();
28
29 QStringList fields = identifier.split (POINT_IDENTIFIER_DELIMITER_SAFE);
30
31 bool successBefore = m_success;
32
33 // Required format is defined by Point::temporaryPointIdentifier and Point::uniqueIdentifierGenerator
34 if (fields.size () == 2) {
35
36 // Temporary point
37 bool isLastNumeric = true;
38 fields [1].toInt (&isLastNumeric);
39 if (fields [0] != AXIS_CURVE_NAME ||
40 !isLastNumeric) {
41
42 m_success = false;
43
44 }
45
46 } else if (fields.size () == 3) {
47
48 // Regular point
49 bool isLastNumeric = true;
50 fields [2].toInt (&isLastNumeric);
51 if (!isLastNumeric) {
52
53 m_success = false;
54
55 }
56
57 } else {
58
59 // Unexpected number of arguments
60 m_success = false;
61
62 }
63
64 if (!m_success && successBefore) {
65 m_badPointName = point.identifier ();
66 }
67
68 return (m_success ? CALLBACK_SEARCH_RETURN_CONTINUE :
70}
const QString AXIS_CURVE_NAME
@ CALLBACK_SEARCH_RETURN_CONTINUE
Continue normal execution of the search.
@ CALLBACK_SEARCH_RETURN_INTERRUPT
Immediately terminate the current search.
const QString POINT_IDENTIFIER_DELIMITER_SAFE
QString identifier() const
Unique identifier for a specific Point.
Definition: Point.cpp:268

◆ success()

bool CallbackDocumentScrub::success ( ) const

Scrub overall result.

Definition at line 72 of file CallbackDocumentScrub.cpp.

73{
74 return m_success;
75}

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