Pointer cleanup (#242)
- Made greater use of smart pointers, eliminating many instances of manual memory management - Do not use pointers at all for many non-polymorphic classes - Assorted other code cleanup
This commit is contained in:
+11
-10
@@ -18,6 +18,7 @@
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "TextNode.h"
|
||||
|
||||
|
||||
@@ -105,25 +106,25 @@ namespace glabels
|
||||
///
|
||||
/// Get text, expand if necessary
|
||||
///
|
||||
QString TextNode::text( const merge::Record* record,
|
||||
const Variables* variables ) const
|
||||
QString TextNode::text( const merge::Record& record,
|
||||
const Variables& variables ) const
|
||||
{
|
||||
QString value("");
|
||||
|
||||
bool haveRecordField = mIsField && record &&
|
||||
record->contains(mData) &&
|
||||
!record->value(mData).isEmpty();
|
||||
bool haveVariable = mIsField && variables &&
|
||||
variables->contains(mData) &&
|
||||
!(*variables)[mData].value().isEmpty();
|
||||
bool haveRecordField = mIsField &&
|
||||
record.contains(mData) &&
|
||||
!record.value(mData).isEmpty();
|
||||
bool haveVariable = mIsField &&
|
||||
variables.contains(mData) &&
|
||||
!variables[mData].value().isEmpty();
|
||||
|
||||
if ( haveRecordField )
|
||||
{
|
||||
value = record->value(mData);
|
||||
value = record.value(mData);
|
||||
}
|
||||
else if ( haveVariable )
|
||||
{
|
||||
value = (*variables)[mData].value();
|
||||
value = variables[mData].value();
|
||||
}
|
||||
else if ( !mIsField )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user