Attribute.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #ifndef ATTRIBUTE_H
  2. #define ATTRIBUTE_H
  3. #include <iostream>
  4. using namespace std;
  5. /**
  6. * A structure to store the attributes of graph elements present in GraphML file.
  7. */
  8. struct Attribute
  9. {
  10. QString sName; /*!< Name of the attribute */
  11. QString sType; /*!< Type of the attribute */
  12. bool bHasDefaultValue; /*!< Flag to specify whether the attribute is associated with some default value */
  13. QString sDefaultValue; /*!< Default value for the attribute */
  14. /**
  15. * Assign empty values to the structure variable
  16. */
  17. Attribute()
  18. {
  19. sName ="";
  20. sType ="";
  21. bHasDefaultValue = false;
  22. sDefaultValue = DEFAULT_NONE;
  23. }
  24. /**
  25. * Assign name and type to the structure variable
  26. *
  27. * @param sAttributeName
  28. * string containing the attribute name
  29. *
  30. * @param sAttributeType
  31. * string containing the attribute type
  32. */
  33. Attribute(QString sAttributeName , QString sAttributeType)
  34. {
  35. sName = sAttributeName;
  36. sType = sAttributeType;
  37. bHasDefaultValue = false;
  38. sDefaultValue = DEFAULT_NONE;
  39. }
  40. /**
  41. * Assign supplied values to the structure variable
  42. *
  43. * @param sAttributeName
  44. * string containing the attribute name
  45. *
  46. * @param sAttributeType
  47. * string containing the attribute type
  48. *
  49. * @param hasDefaultValue
  50. * bool value that describes if attribute has default value or not
  51. *
  52. * @param sAttributeDefaultValue
  53. * string containing the default value for that attribute
  54. */
  55. Attribute(QString sAttributeName, QString sAttributeType,
  56. bool hasDefaultValue, QString sAttributeDefaultValue)
  57. {
  58. sName = sAttributeName;
  59. sType = sAttributeType;
  60. bHasDefaultValue = hasDefaultValue;
  61. sDefaultValue = sAttributeDefaultValue;
  62. }
  63. /**
  64. * Print the structure variable on standard output
  65. *
  66. * @pre none
  67. *
  68. * @param none
  69. *
  70. * @return none
  71. *
  72. * @throw none
  73. */
  74. void print()
  75. {
  76. cout << sName.toStdString() << " " << sType.toStdString()
  77. << " " << bHasDefaultValue << " "
  78. << " " << sDefaultValue.toStdString() << endl;
  79. }
  80. };
  81. /**
  82. * A user defined type for list of Attribute structures.
  83. */
  84. typedef QList<Attribute> AttributeList;
  85. #endif // ATTRIBUTE_H