OWLNext    7.0
Borland's Object Windows Library for the modern age
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
autostck.cpp
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectComponents
3// Copyright (c) 1994, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// OLE Automation - Implementation of TAutoStack
7//----------------------------------------------------------------------------
8#include <ocf/pch.h>
9#include <ocf/appdesc.h>
10#include <ocf/ocreg.h>
11#include <ocf/occtrl.h>
12
13namespace ocf {
14
15//----------------------------------------------------------------------------
16// TAutoStack implementation
17//
18
20 int argcount, int named, long * map,
22:
23 Owner(owner),
24 Stack((TAutoVal*)stack),
25 LangId(LANGIDFROMLCID(locale)),
26 ArgCount(argcount),
27 NamedCount(named),
28 NamedIds(map),
29 CurrentArg(-1),
30 DispId(id)
31{
32}
33
35{
37 for (val = Stack; ArgCount; --*const_cast<int*>(&ArgCount), val++)
38 val->Restore();
39}
40
42{
43 TAutoSymbol* argSymbol = nullptr;
44 if (index < ArgSymbolCount)
45 argSymbol = index >= 0 ? Symbol + index + 1 : Symbol;
46 int vIndex = ArgCount - index - 1; // index if not a named argument
47 if (index == TAutoStack::SetValue || // property value to set
48 index >= ArgCount-NamedCount) { // named or out of range
49 for (vIndex = NamedCount; --vIndex >= 0; )
50 if (NamedIds[vIndex] == index) {
51 break;
52 }
53 }
55 if (vIndex >= 0) {
56 CurrentArg = vIndex; // save index for error return
58 val->SetLocale(LangId);
59 if ((val->GetDataType() == atString) &&
60 ((argSymbol) && (argSymbol->IsEnum()) &&
61 (argSymbol->GetEnum()->Convert(*val, Default))))
62 return Default;
63 }
64 else if (index == TAutoStack::SetValue) {
66 }
67 else {
68 val = &Default;
69 val->SetLocale(LangId);
70 if (!argSymbol)
72 const _TCHAR* dfltStr = argSymbol->Doc.Translate(LangId); // load default
73 if (!dfltStr)
75 Default = dfltStr; // makes a BSTR in order to use OLE conversions
76 }
77 return *val;
78}
79
80
81} // OCF namespace
82
83//==============================================================================
84
TAppDescriptor - OLE application descriptor definitions.
owl::TLangId LangId
Definition autodefs.h:827
TAutoStack(DISPID dispid, VARIANT *stack, TLocaleId locale, int argcount, int namedcount, long *map, TServedObject *owner)
Definition autostck.cpp:19
TAutoVal Default
Definition autodefs.h:835
TAutoSymbol * Symbol
Symbol of method/prop, args follow.
Definition autodefs.h:822
TAutoVal & operator[](int index)
Definition autostck.cpp:41
int CurrentArg
Index of last arg requested by operator[].
Definition autodefs.h:823
TAutoVal * Stack
Definition autodefs.h:836
long * NamedIds
Definition autodefs.h:834
Automation data element (same data as OLE/BASIC VARIANT)
Definition autodefs.h:526
TAutoVal * DereferenceVariant()
Definition autodefs.h:1747
OLE object exposed for automated access of internal object.
Definition autodefs.h:972
static void Raise(TError err)
Definition autoval.cpp:831
@ xParameterMissing
Definition autodefs.h:124
@ xNoDefaultValue
Definition autodefs.h:125
Include for OC, gets common headers when precompiled headers are enabled.
Object Component Framework (COM encapsulation)
Definition appdesc.h:22
unsigned long TLocaleId
Definition autodefs.h:72
@ atString
Definition autodefs.h:331
Definition of TOcControl class - Proxy object representing a control in.
OLE Registration definitions.
Symbol table element.
Definition autodefs.h:404