Commit fe2f4239 authored by claes's avatar claes

Argument added in function attributesAll

parent 46f87c73
...@@ -145,6 +145,7 @@ public: ...@@ -145,6 +145,7 @@ public:
bool attributeIsEqual( const char *n, int idx = 0) const throw (wb_error) { check(); return m_nrep->attributeIsEqual( n, idx);} bool attributeIsEqual( const char *n, int idx = 0) const throw (wb_error) { check(); return m_nrep->attributeIsEqual( n, idx);}
char *segmentsAll( int idx = 0) const throw (wb_error) { check(); return m_nrep->segmentsAll(idx);} char *segmentsAll( int idx = 0) const throw (wb_error) { check(); return m_nrep->segmentsAll(idx);}
char *attributesAll( int idx = 0) const throw (wb_error) { check(); return m_nrep->attributesAll(idx);} char *attributesAll( int idx = 0) const throw (wb_error) { check(); return m_nrep->attributesAll(idx);}
char *attributesAllTrue( int idx = 0) const throw (wb_error) { check(); return m_nrep->attributesAll(idx, 0, true);}
// Id representation // Id representation
char *vid( char *res = 0) const throw (wb_error) { check(); return m_nrep->volume( res);} char *vid( char *res = 0) const throw (wb_error) { check(); return m_nrep->volume( res);}
......
...@@ -891,7 +891,7 @@ char *wb_nrep::segmentsAll(int idx, char *res) ...@@ -891,7 +891,7 @@ char *wb_nrep::segmentsAll(int idx, char *res)
} }
} }
char *wb_nrep::attributesAll(int idx, char *res) char *wb_nrep::attributesAll(int idx, char *res, bool true_db)
{ {
static char result[256]; static char result[256];
...@@ -906,12 +906,34 @@ char *wb_nrep::attributesAll(int idx, char *res) ...@@ -906,12 +906,34 @@ char *wb_nrep::attributesAll(int idx, char *res)
} }
} }
else { else {
if ( res) { if ( !m_hasSuper || m_shadowed || true_db) {
strcpy( res, oname + attr[idx].offs); if ( res) {
return res; strcpy( res, oname + attr[idx].offs);
return res;
}
else {
strcpy( result, oname + attr[idx].offs);
return result;
}
} }
else { else {
strcpy( result, oname + attr[idx].offs); strcpy( result, "");
for ( int i = idx; i < num_attr; i++) {
if ( !attr[i].isSuper) {
if ( result[0] != 0)
strcat( result, ".");
int l = strlen(result);
strncat( result, oname + attr[i].offs, attr[i].len);
if ( attr[i].index != -1)
sprintf( &result[ l + attr[i].len], "[%d]", attr[i].index);
else
result[ l + attr[i].len] = 0;
}
}
if ( res) {
strcpy( res, result);
return res;
}
return result; return result;
} }
} }
......
...@@ -113,7 +113,7 @@ public: ...@@ -113,7 +113,7 @@ public:
bool attributeIsEqual( const char *n, int idx = 0); bool attributeIsEqual( const char *n, int idx = 0);
int bodyOffset() const { return b_offset;} int bodyOffset() const { return b_offset;}
int bodySize() const { return b_size;} int bodySize() const { return b_size;}
char *attributesAll( int idx = 0, char *res = 0); char *attributesAll( int idx = 0, char *res = 0, bool true_db = false);
char *segmentsAll( int idx = 0, char *res = 0); char *segmentsAll( int idx = 0, char *res = 0);
bool hasSuper() { return m_hasSuper;} bool hasSuper() { return m_hasSuper;}
void setShadowed( bool shadowed) { m_shadowed = shadowed;} void setShadowed( bool shadowed) { m_shadowed = shadowed;}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment