| | |
API Flag Setting, is there no better way?
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Apr 2008
Posts: 64
Reputation:
Solved Threads: 1
I am writing a database API in C++ and I cant seem to think of a good way to handle the errors. For example if certain error conditions are met I would like to set some sort of error flag and allow every class to check that flag. I have the following classes
Database
Table (included in Database)
Column (included in Table)
I want to set some sort of flag in Column if an error is found and then check it on the next function call to a function of table or database. I was thinking I would create an error class as follows:
An Error object would be initialized in the Database class(top level class) but to set it I would have to have return types that could somehow pass up to Database every time. Is there a way to make a flag that every class can see and access? That or is there a better way to do this that I am missing? I really don't like to waste the overhead of passing info up and down the chain.
Thanks!!
Database
Table (included in Database)
Column (included in Table)
I want to set some sort of flag in Column if an error is found and then check it on the next function call to a function of table or database. I was thinking I would create an error class as follows:
C++ Syntax (Toggle Plain Text)
class Error { bool error; string message; Error() { error = false; message = " "; } bool isError() { return error; string getMessage() { return message; } }
Thanks!!
Thanks for information, actually I was looking for this, if you want know more information about c++ static analysis keep visit this forum.
![]() |
Similar Threads
- Help with Win32 API Menu (C)
- Help needed on "MDI child forms" (Visual Basic 4 / 5 / 6)
- Shared Memory Object Access (C++)
- Inventory Management DAtabse (Database Design)
- Multiple choice quiz (Visual Basic 4 / 5 / 6)
- Pipelining (Assembly)
- join thread (Java)
Other Threads in the C++ Forum
- Previous Thread: Problem with string to numeric conversion
- Next Thread: Need Help in Downloading a File from Internet using C++ or Win32 API?
Views: 211 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll encryption error file forms fstream function functions game getline givemetehcodez google graph homeworkhelper iamthwee ifstream input int integer java lazy lib linkedlist linux loop looping loops map math matrix memory microsoft newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort string strings struct studio system template templates test text tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






