Click here to Skip to main content
15,918,003 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: copying vectors/lists Pin
mcsherry30-Sep-04 9:39
mcsherry30-Sep-04 9:39 
GeneralRe: copying vectors/lists Pin
Joaquín M López Muñoz30-Sep-04 10:21
Joaquín M López Muñoz30-Sep-04 10:21 
Generaledt1 problem in vc .net Pin
Michael Liu30-Sep-04 2:45
Michael Liu30-Sep-04 2:45 
GeneralRe: edt1 problem in vc .net Pin
Iain Clarke, Warrior Programmer30-Sep-04 5:10
Iain Clarke, Warrior Programmer30-Sep-04 5:10 
GeneralData transfer from one dialog to a property page. Pin
Rajesh_K_Sharma30-Sep-04 2:23
Rajesh_K_Sharma30-Sep-04 2:23 
GeneralRe: Data transfer from one dialog to a property page. Pin
David Crow30-Sep-04 5:08
David Crow30-Sep-04 5:08 
GeneralMaterializing derived classes Pin
Jerome Conus30-Sep-04 2:00
Jerome Conus30-Sep-04 2:00 
GeneralRe: Materializing derived classes Pin
Iain Clarke, Warrior Programmer30-Sep-04 4:48
Iain Clarke, Warrior Programmer30-Sep-04 4:48 
You could have something like:

#include "BootStrap.h"

class Segment
{
...
public:
    static Segment *FromString (CString s);
...
protected:
    virtual BOOL DoesThisStringMatchMe (CString s) = 0;
    virtual BOOL ProcessTheStrings (CString s)

    DECLARE_ROOT_CLASS(CBaseFilter)
};


So the Path object knows nothing about different segments.

If you read the article Enumerate your leaf classes it gives
a good explanation of how you can go through each descendant
of Segment

Segment *FromString (CString s)
{
    // Enumerate the different segment types.
    int nType, nTypes = GetRegisteredManufactoringPlantCount();
    Segment *pGuess = NULL;
    for (nType = 0; nType < nTypes; nType++)
    {
        CBootStrapper<CBaseFilter>* pBoot = GetRegisteredManufactoringPlant(nIdx);
        pGuess = pBoot->CreateObject ();
        if (pGuess->DoesThisStringMatchMe (s))
            break;

        delete pGuess;
        pGuess = NULL;
    }

    if (!pGuess)
        return NULL;
    pGuess->ProcessString (s);
    return pGuess;
}


This hasn't been compiled, obviously, and you'll need to read Jaded Hobos article for
details, but I've used this method in the past. You'll see my comment on his article!

Good luck,

Iain.
GeneralTo track an errors-messages Pin
Billar30-Sep-04 1:32
Billar30-Sep-04 1:32 
Generalstl iterators Pin
RChin30-Sep-04 1:21
RChin30-Sep-04 1:21 
GeneralRe: stl iterators Pin
RChin30-Sep-04 1:48
RChin30-Sep-04 1:48 
GeneralRe: stl iterators Pin
Iain Clarke, Warrior Programmer30-Sep-04 4:54
Iain Clarke, Warrior Programmer30-Sep-04 4:54 
GeneralRe: stl iterators Pin
Joaquín M López Muñoz30-Sep-04 9:10
Joaquín M López Muñoz30-Sep-04 9:10 
GeneralRe: stl iterators Pin
RChin30-Sep-04 23:20
RChin30-Sep-04 23:20 
GeneralAsserion failed Pin
30-Sep-04 0:22
suss30-Sep-04 0:22 
GeneralRe: Asserion failed Pin
22491730-Sep-04 1:08
22491730-Sep-04 1:08 
GeneralRe: Asserion failed Pin
David Crow30-Sep-04 5:48
David Crow30-Sep-04 5:48 
GeneralProvide an Interface to my Program Pin
sweep12329-Sep-04 22:55
sweep12329-Sep-04 22:55 
GeneralRe: Provide an Interface to my Program Pin
22491730-Sep-04 1:25
22491730-Sep-04 1:25 
GeneralArrow Keys Pin
Neelesh K J Jain29-Sep-04 21:09
Neelesh K J Jain29-Sep-04 21:09 
GeneralRe: Arrow Keys Pin
V.29-Sep-04 22:32
professionalV.29-Sep-04 22:32 
GeneralRe: Arrow Keys Pin
Neelesh K J Jain29-Sep-04 23:22
Neelesh K J Jain29-Sep-04 23:22 
GeneralRe: Arrow Keys Pin
V.30-Sep-04 1:33
professionalV.30-Sep-04 1:33 
GeneralRe: Arrow Keys Pin
David Crow30-Sep-04 5:50
David Crow30-Sep-04 5:50 
QuestionWhich memory allocator to use? Pin
George Ionescu29-Sep-04 20:30
George Ionescu29-Sep-04 20:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.