[DEVELOPMENT ENVIRONMENT]
* NEW: Database editor: The import CSV dialog is now a wizard. [GB.DB] * BUG: Fix a crash when creating twice the same table with the same connection. [GB.FORM] * NEW: Spinner: Display the label below the rotating spinner. * NEW: Spinner.Wait() is a new method that calls the event loop, and ensures that it is not called more than every 200 milliseconds. * BUG: Wizard: Animation is correct now when the Border property is set. [GB.QT4] * BUG: Showing a window now automatically raises it. [GB.QT5] * BUG: Showing a window now automatically raises it. git-svn-id: svn://localhost/gambas/trunk@7138 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
00e83980de
commit
fd60cd1bec
13 changed files with 181 additions and 123 deletions
|
@ -3,11 +3,11 @@
|
|||
Property Read Cancelled As Boolean
|
||||
|
||||
Private $hPanel As Panel
|
||||
Private $hMovieBox As MovieBox
|
||||
Private $hLabel As Label
|
||||
Private $hButton As Button
|
||||
Private $bCancelled As Boolean
|
||||
Private $fLastWait As Float
|
||||
Private $hSpinner As Spinner
|
||||
|
||||
Private Sub DisableWindow(hWindow As Window, bDisable As Boolean)
|
||||
|
||||
|
@ -27,17 +27,24 @@ Public Sub _new(hWindow As Window, Optional bWithCancel As Boolean)
|
|||
With $hPanel
|
||||
.Ignore = True
|
||||
.Move((hWindow.ClientW - Desktop.Scale * 16) / 2, (hWindow.ClientH - Desktop.Scale * 16) / 2, Desktop.Scale * 16, Desktop.Scale * 16)
|
||||
.Background = Color.LightForeground
|
||||
'.Background = Color.LightForeground
|
||||
End With
|
||||
|
||||
$hMovieBox = New MovieBox($hPanel)
|
||||
With $hMovieBox
|
||||
.Alignment = Align.Center
|
||||
.Background = Color.White
|
||||
.Path = "img/waiting.gif"
|
||||
.Playing = True
|
||||
.Move(8, 8, $hPanel.W - 16, $hPanel.H - 16)
|
||||
End With
|
||||
$hSpinner = New Spinner($hPanel)
|
||||
With $hSpinner
|
||||
.Move(8, 8, $hPanel.W - 16, $hPanel.H - 16)
|
||||
.Show
|
||||
.Start
|
||||
End With
|
||||
|
||||
' $hMovieBox = New MovieBox($hPanel)
|
||||
' With $hMovieBox
|
||||
' .Alignment = Align.Center
|
||||
' .Background = Color.White
|
||||
' .Path = "img/waiting.gif"
|
||||
' .Playing = True
|
||||
' .Move(8, 8, $hPanel.W - 16, $hPanel.H - 16)
|
||||
' End With
|
||||
|
||||
$hLabel = New Label($hPanel)
|
||||
With $hLabel
|
||||
|
|
|
@ -14,12 +14,12 @@ Private $iIgnore As Integer
|
|||
|
||||
Private $iLine As Integer
|
||||
Private $bImport As Boolean
|
||||
Private $bCancel As Boolean
|
||||
|
||||
Private Const REMOVE_ACC As String = "ÀÁÂÃÄÅàáâãäå[a]Ææ[ae]Çç[c]ÈÉÊËèéêë[e]ÌÍÎÏìíîï[i]Ññ[n]ÒÓÔÕÖòóôõö[o]ÙÚÛÜùúûü[u]Ýýÿ[y]ß[ss]°[]"
|
||||
'Private Const REMOVE_ACC As String = "ÀÁÂÃÄÅàáâãäå[a]Ææ[ae]Çç[c]ÈÉÊËèéêë[e]ÌÍÎÏìíîï[i]Ññ[n]ÒÓÔÕÖòóôõö[o]ÙÚÛÜùúûü[u]Ýýÿ[y]ß[ss]°[]"
|
||||
|
||||
Static Public Function Run(hConn As Connection, aTable As String[], sPath As String) As Boolean
|
||||
Static Public Function Run(hConn As Connection, aTable As String[]) As Boolean
|
||||
|
||||
$sPath = sPath
|
||||
$hConn = hConn
|
||||
$aTable = aTable
|
||||
Table = ""
|
||||
|
@ -28,11 +28,9 @@ Static Public Function Run(hConn As Connection, aTable As String[], sPath As Str
|
|||
|
||||
End
|
||||
|
||||
Public Sub btnOK_Click()
|
||||
Public Sub wizImport_Close()
|
||||
|
||||
DoImport
|
||||
btnOK.Enabled = False
|
||||
tabImport.Index = 2
|
||||
|
||||
End
|
||||
|
||||
|
@ -44,11 +42,12 @@ End
|
|||
|
||||
Public Sub Form_Open()
|
||||
|
||||
fprImport.Path = $sPath
|
||||
'txtPath.Text = $sPath
|
||||
|
||||
spnImport.Stop
|
||||
|
||||
fchImport.Filter = ["*.csv", ("CSV files"), "*", ("All files")]
|
||||
fchImport.Value = Settings["/Connection/ImportPath"]
|
||||
|
||||
cmbTable.List = $aTable
|
||||
cmbTable.Text = File.BaseName($sPath)
|
||||
|
||||
txtPreview.Font = Font[Settings["/Editor/Font", Project.DEFAULT_FONT]]
|
||||
|
||||
|
@ -57,12 +56,6 @@ Public Sub Form_Open()
|
|||
gvwMessage.Columns[0].Width = Desktop.Scale * 6
|
||||
gvwMessage.Columns[1].Text = ("Message")
|
||||
|
||||
cmbCharset.Text = Project.Config["/FImportTable/Charset", "UTF-8"]
|
||||
cmbEndOfLine.Text = Project.Config["/FImportTable/EndOfLine", "Unix"]
|
||||
cmbDelim.Text = Project.Config["/FImportTable/Delim", ","]
|
||||
cmbEscape.Text = Project.Config["/FImportTable/Escape", Chr$(34)]
|
||||
chkStrip.Value = Project.Config["/FImportTable/StripSpace", False]
|
||||
txtIgnore.Value = Project.Config["/FImportTable/Ignore", 0]
|
||||
Settings.Read(Me)
|
||||
|
||||
End
|
||||
|
@ -108,6 +101,8 @@ Private Sub UpdateKey()
|
|||
Dim iLine As Integer
|
||||
Dim sData As String
|
||||
|
||||
If wizImport.Index < 1 Then Return
|
||||
|
||||
UpdateDelim
|
||||
|
||||
hFile = Open $sPath
|
||||
|
@ -177,9 +172,13 @@ Private Sub DoMessage(sMsg As String, Optional bNoLine As Boolean)
|
|||
gvwMessage.Rows.Count = iRow + 1
|
||||
|
||||
If Not bNoLine Then gvwMessage[iRow, 0].Text = CStr($iLine)
|
||||
gvwMessage[iRow, 1].Text = sMsg
|
||||
If sMsg Begins "** " Then
|
||||
gvwMessage[iRow, 1].Text = Mid$(sMsg, 3)
|
||||
gvwMessage[iRow, 1].Foreground = Color.Red
|
||||
Else
|
||||
gvwMessage[iRow, 1].Text = sMsg
|
||||
Endif
|
||||
|
||||
If tabImport.Index <> 2 Then tabImport.Index = 2
|
||||
Wait
|
||||
|
||||
End
|
||||
|
@ -188,11 +187,6 @@ End
|
|||
Private Function TransformField(sName As String) As String
|
||||
|
||||
Dim iInd As Integer
|
||||
Dim sCar As String
|
||||
Dim iPos As Integer
|
||||
Dim iPosL As Integer
|
||||
Dim iPosR As Integer
|
||||
Dim sNewName As String
|
||||
|
||||
sName = Trim(sName)
|
||||
|
||||
|
@ -202,20 +196,20 @@ Private Function TransformField(sName As String) As String
|
|||
Endif
|
||||
Next
|
||||
|
||||
For iInd = 1 To String.Len(sName)
|
||||
sCar = String.Mid$(sName, iInd, 1)
|
||||
iPos = InStr(REMOVE_ACC, sCar)
|
||||
If iPos Then
|
||||
iPosL = InStr(REMOVE_ACC, "[", iPos + 1)
|
||||
iPosR = InStr(REMOVE_ACC, "]", iPos + 1)
|
||||
If iPosL <> 0 And If iPosR <> 0 And If iPosL < iPosR Then
|
||||
sCar = Mid$(REMOVE_ACC, iPosL + 1, iPosR - iPosL - 1)
|
||||
Endif
|
||||
Endif
|
||||
sNewName &= sCar
|
||||
Next
|
||||
|
||||
Return sNewName
|
||||
' For iInd = 1 To String.Len(sName)
|
||||
' sCar = String.Mid$(sName, iInd, 1)
|
||||
' iPos = InStr(REMOVE_ACC, sCar)
|
||||
' If iPos Then
|
||||
' iPosL = InStr(REMOVE_ACC, "[", iPos + 1)
|
||||
' iPosR = InStr(REMOVE_ACC, "]", iPos + 1)
|
||||
' If iPosL <> 0 And If iPosR <> 0 And If iPosL < iPosR Then
|
||||
' sCar = Mid$(REMOVE_ACC, iPosL + 1, iPosR - iPosL - 1)
|
||||
' Endif
|
||||
' Endif
|
||||
' sNewName &= sCar
|
||||
' Next
|
||||
|
||||
Return Util.RemoveAccents(sName)
|
||||
|
||||
End
|
||||
|
||||
|
@ -306,9 +300,10 @@ Private Sub DoImport()
|
|||
Dim sKey As String
|
||||
Dim nImport As Integer
|
||||
Dim sDestCharset As String
|
||||
Dim hWaiting As CWaitingAnimation
|
||||
|
||||
$bImport = True
|
||||
$bCancel = False
|
||||
|
||||
gvwMessage.Rows.Count = 0
|
||||
hConn = $hConn
|
||||
sTable = Trim(cmbTable.Text)
|
||||
|
@ -316,7 +311,7 @@ Private Sub DoImport()
|
|||
|
||||
UpdateDelim
|
||||
|
||||
hWaiting = New CWaitingAnimation(Me, True)
|
||||
spnImport.Start
|
||||
|
||||
If hConn.IgnoreCharset Then
|
||||
sDestCharset = "UTF-8"
|
||||
|
@ -407,14 +402,15 @@ Private Sub DoImport()
|
|||
rData.Update
|
||||
|
||||
Inc nImport
|
||||
hWaiting.SetValue(Seek(hFile) / Lof(hFile))
|
||||
If hWaiting.Cancelled Then Error.Raise(("Cancelled by user"))
|
||||
spnImport.Value = Seek(hFile) / Lof(hFile)
|
||||
spnImport.Wait
|
||||
If $bCancel Then Error.Raise(("Cancelled by user"))
|
||||
|
||||
Wend
|
||||
|
||||
hWaiting.SetValue(1)
|
||||
spnImport.Value = 1
|
||||
hConn.Commit
|
||||
hWaiting.Stop
|
||||
spnImport.Stop
|
||||
|
||||
If nImport = 0 Then
|
||||
DoMessage(("No record imported."))
|
||||
|
@ -429,6 +425,7 @@ Private Sub DoImport()
|
|||
Finally
|
||||
|
||||
Close #hFile
|
||||
spnImport.Stop
|
||||
$bImport = False
|
||||
|
||||
Catch
|
||||
|
@ -459,8 +456,52 @@ Public Sub Form_Close()
|
|||
|
||||
End
|
||||
|
||||
Public Sub tabImport_Click()
|
||||
Public Sub wizImport_BeforeChange()
|
||||
|
||||
If tabImport.Index = 0 Then btnOK.Enabled = True
|
||||
Select Case wizImport.Index
|
||||
|
||||
Case 0
|
||||
$sPath = fchImport.SelectedPath
|
||||
If Not Exist($sPath) Then Stop Event
|
||||
|
||||
cmbCharset.Text = Project.Config["/FImportTable/Charset", "UTF-8"]
|
||||
cmbEndOfLine.Text = Project.Config["/FImportTable/EndOfLine", "Unix"]
|
||||
cmbDelim.Text = Project.Config["/FImportTable/Delim", ","]
|
||||
cmbEscape.Text = Project.Config["/FImportTable/Escape", Chr$(34)]
|
||||
chkStrip.Value = Project.Config["/FImportTable/StripSpace", False]
|
||||
txtIgnore.Value = Project.Config["/FImportTable/Ignore", 0]
|
||||
cmbTable.Text = File.BaseName($sPath)
|
||||
|
||||
End Select
|
||||
|
||||
End
|
||||
|
||||
Public Sub wizImport_Cancel()
|
||||
|
||||
If $bImport Then
|
||||
$bCancel = True
|
||||
Else
|
||||
Me.Close
|
||||
Endif
|
||||
|
||||
End
|
||||
|
||||
Public Sub wizImport_Arrange()
|
||||
|
||||
spnImport.Move((wizImport.ClientW - spnImport.W) \ 2, (wizImport.ClientH - spnImport.H) \ 2)
|
||||
|
||||
End
|
||||
|
||||
Public Sub fchImport_Activate()
|
||||
|
||||
wizImport.MoveNext
|
||||
|
||||
End
|
||||
|
||||
Public Sub wizImport_Change()
|
||||
|
||||
If wizImport.Index = 1 Then
|
||||
UpdateKey
|
||||
Endif
|
||||
|
||||
End
|
||||
|
|
|
@ -1,22 +1,25 @@
|
|||
# Gambas Form File 3.0
|
||||
|
||||
{ Form Form
|
||||
MoveScaled(0,0,70,64)
|
||||
MoveScaled(0,0,102,72)
|
||||
Text = ("Import file")
|
||||
Icon = Picture["icon:/medium/open"]
|
||||
Arrangement = Arrange.Vertical
|
||||
Arrangement = Arrange.Fill
|
||||
Spacing = True
|
||||
Margin = True
|
||||
{ tabImport TabPanel
|
||||
MoveScaled(1,1,66,57)
|
||||
Expand = True
|
||||
{ wizImport Wizard
|
||||
MoveScaled(1,1,98,69)
|
||||
Arrangement = Arrange.Fill
|
||||
Count = 4
|
||||
TextFont = Font["Bold,+2"]
|
||||
Border = False
|
||||
ActionText = ("Import")
|
||||
ActionPicture = Picture["icon:/small/open"]
|
||||
Animated = True
|
||||
Index = 0
|
||||
Text = ("File properties")
|
||||
{ fprImport FileProperties
|
||||
MoveScaled(2,1,62,50)
|
||||
Border = False
|
||||
Text = ("Select the CSV file to import")
|
||||
{ fchImport FileChooser
|
||||
MoveScaled(2,2,94,54)
|
||||
}
|
||||
Index = 1
|
||||
Text = ("Options")
|
||||
|
@ -132,36 +135,19 @@
|
|||
Index = 2
|
||||
Text = ("Preview")
|
||||
{ txtPreview TextArea
|
||||
MoveScaled(1,1,61,43)
|
||||
MoveScaled(1,2,61,43)
|
||||
ReadOnly = True
|
||||
Border = False
|
||||
}
|
||||
Index = 3
|
||||
Text = ("Messages")
|
||||
Text = ("Import")
|
||||
{ gvwMessage GridView
|
||||
MoveScaled(2,1,59,49)
|
||||
Border = False
|
||||
MoveScaled(1,1,59,49)
|
||||
}
|
||||
{ spnImport Spinner
|
||||
MoveScaled(66,24,18,18)
|
||||
Ignore = True
|
||||
Label = True
|
||||
}
|
||||
Index = 0
|
||||
}
|
||||
{ HBox1 HBox
|
||||
MoveScaled(1,59,66,4)
|
||||
Spacing = True
|
||||
{ Panel1 Panel
|
||||
MoveScaled(7,1,3,2)
|
||||
Expand = True
|
||||
}
|
||||
{ btnOK Button
|
||||
MoveScaled(31,0,16,4)
|
||||
Text = Shortcut(("Import"), "I")
|
||||
Picture = Picture["icon:/small/open"]
|
||||
Default = True
|
||||
}
|
||||
{ btnCancel Button
|
||||
MoveScaled(48,0,16,4)
|
||||
Text = ("Close")
|
||||
Picture = Picture["icon:/small/close"]
|
||||
Cancel = True
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -177,7 +177,7 @@ Private Sub DoCopyTable(hSrc As Connection, hDst As Connection, sSrc As String,
|
|||
rDst = hDst.Create(sDst)
|
||||
For iInd = 0 To rSrc.Fields.Count - 1
|
||||
rDst[iInd] = rSrc[iInd]
|
||||
If rSrc.Fields[iInd].Type = gb.String Then
|
||||
If rSrc.Fields[iInd].Type = gb.String And If rSrc[iInd] Then
|
||||
Try rDst[iInd] = Conv(rSrc[iInd], sSrcCharset, sDstCharset)
|
||||
Endif
|
||||
Next
|
||||
|
|
|
@ -1686,14 +1686,7 @@ Public Sub btnImport_Click()
|
|||
|
||||
If SaveTable() Then Return
|
||||
|
||||
Dialog.Title = ("Select the CSV file to import")
|
||||
Dialog.Filter = ["*.csv", ("CSV files"), "*", ("All files")]
|
||||
Dialog.Path = Settings["/Connection/ImportPath"]
|
||||
If Dialog.OpenFile() Then Return
|
||||
Settings["/Connection/ImportPath"] = Dialog.Path
|
||||
If Not Exist(Dialog.Path) Then Return
|
||||
|
||||
FImportTable.Run($hConn, GetTableList(), Dialog.Path)
|
||||
FImportTable.Run($hConn, GetTableList())
|
||||
If FImportTable.Table Then
|
||||
LoadList(FImportTable.Table)
|
||||
Else
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
Arrangement = Arrange.Vertical
|
||||
Spacing = True
|
||||
Count = 11
|
||||
TextFont = Font["Bold,+3"]
|
||||
TextFont = Font["Bold,+2"]
|
||||
ShowIndex = True
|
||||
Border = False
|
||||
ActionText = ("Create package")
|
||||
|
|
|
@ -2730,6 +2730,10 @@ Stop
|
|||
m
|
||||
|
||||
|
||||
Wait
|
||||
m
|
||||
|
||||
|
||||
DrawingArea_Draw
|
||||
m
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Gambas Project File 3.0
|
||||
# Compiled with Gambas 3.7.90
|
||||
Title=More controls for graphical components
|
||||
Startup=FTabPanel
|
||||
Startup=FSpinner
|
||||
Version=3.7.90
|
||||
VersionFile=1
|
||||
Component=gb.image
|
||||
|
|
|
@ -18,6 +18,7 @@ Private $hTimer As Timer
|
|||
Private $iBorder As Integer
|
||||
Private $bLabel As Boolean
|
||||
Private $fValue As Float
|
||||
Private $fLastWait As Float
|
||||
|
||||
Public Sub _new()
|
||||
|
||||
|
@ -42,6 +43,18 @@ Public Sub Stop()
|
|||
|
||||
End
|
||||
|
||||
Public Sub Wait()
|
||||
|
||||
If $fLastWait = 0 Or If (Timer - $fLastWait) >= 0.2 Then
|
||||
Wait 0.05
|
||||
$fLastWait = Timer
|
||||
Else
|
||||
Wait
|
||||
Endif
|
||||
|
||||
End
|
||||
|
||||
|
||||
Public Sub DrawingArea_Draw()
|
||||
|
||||
Dim iFlag As Integer
|
||||
|
@ -52,35 +65,48 @@ Public Sub DrawingArea_Draw()
|
|||
Dim D As Float
|
||||
Dim I As Integer
|
||||
Dim C As Float
|
||||
Dim W As Float
|
||||
Dim H As Float
|
||||
|
||||
If Not Me.Design Then
|
||||
If $fStartTime = 0 Then Goto DRAW_BORDER
|
||||
D = Frac(Timer - $fStartTime) * Pi(2)
|
||||
Endif
|
||||
|
||||
X = Paint.W / 2
|
||||
Y = Paint.H / 2
|
||||
R = Min(Paint.W, Paint.H) / 2 * 7 / 8
|
||||
W = Paint.W
|
||||
H = Paint.H
|
||||
|
||||
Paint.LineWidth = R / 8
|
||||
Paint.LineCap = Paint.LineCapRound
|
||||
If $bLabel Then
|
||||
H -= Paint.Font.Height
|
||||
Endif
|
||||
|
||||
For I = 0 To 11
|
||||
If H > 0 Then
|
||||
|
||||
X = W / 2
|
||||
Y = H / 2
|
||||
R = Min(W, H) / 2 * 7 / 8
|
||||
|
||||
A = Pi(2) * I / 12
|
||||
C = Frac(1 + (D - A) / Pi(2))
|
||||
Paint.LineWidth = R / 8
|
||||
Paint.LineCap = Paint.LineCapRound
|
||||
|
||||
'Paint.Background = Color.Merge(Color.Background, Color.Foreground, C / 4)
|
||||
Paint.Background = Color.SetAlpha(Color.Foreground, 255 * (1 - C / 4))
|
||||
Paint.MoveTo(X + Cos(A) * R / 2, Y + Sin(A) * R / 2)
|
||||
Paint.LineTo(X + Cos(A) * R, Y + Sin(A) * R)
|
||||
Paint.Stroke
|
||||
For I = 0 To 11
|
||||
|
||||
A = Pi(2) * I / 12
|
||||
C = Frac(1 + (D - A) / Pi(2))
|
||||
|
||||
'Paint.Background = Color.Merge(Color.Background, Color.Foreground, C / 4)
|
||||
Paint.Background = Color.SetAlpha(Color.Foreground, 255 * (1 - C / 4))
|
||||
Paint.MoveTo(X + Cos(A) * R / 2, Y + Sin(A) * R / 2)
|
||||
Paint.LineTo(X + Cos(A) * R, Y + Sin(A) * R)
|
||||
Paint.Stroke
|
||||
|
||||
Next
|
||||
|
||||
Next
|
||||
Endif
|
||||
|
||||
If $bLabel Then
|
||||
Paint.Background = Color.Foreground
|
||||
Paint.DrawText(Format($fValue, "0%"), 0, 0, Paint.W, Paint.H, Align.Center)
|
||||
Paint.DrawText(Format($fValue, "0%"), 0, Paint.H - Paint.Font.Height, Paint.W, Paint.Font.Height, Align.Center)
|
||||
Endif
|
||||
|
||||
DRAW_BORDER:
|
||||
|
|
|
@ -10,5 +10,6 @@ End
|
|||
Public Sub Timer1_Timer()
|
||||
|
||||
Spinner1.Value += 0.005
|
||||
'Print Spinner1.Value
|
||||
|
||||
End
|
||||
|
|
|
@ -124,6 +124,9 @@ Private Sub DoAnimate(iSrc As Integer, iDest As Integer)
|
|||
Dim hCont As Container
|
||||
Dim hSrc As _WizardContainer
|
||||
Dim hDest As _WizardContainer
|
||||
Dim Y As Integer
|
||||
|
||||
Y = If($hWizard.GetBorder(), 1, 0)
|
||||
|
||||
hCont = $hWizard.GetContainer()
|
||||
hSrc = $aStep[iSrc]
|
||||
|
@ -136,7 +139,7 @@ Private Sub DoAnimate(iSrc As Integer, iDest As Integer)
|
|||
|
||||
If iDest > iSrc Then
|
||||
|
||||
hDest.Move(hCont.W, 0)
|
||||
hDest.Move(hCont.W, Y)
|
||||
|
||||
fTime = Timer
|
||||
While hDest.X > 0
|
||||
|
@ -147,7 +150,7 @@ Private Sub DoAnimate(iSrc As Integer, iDest As Integer)
|
|||
|
||||
Else
|
||||
|
||||
hDest.Move(- hCont.W, 0)
|
||||
hDest.Move(- hCont.W, Y)
|
||||
|
||||
fTime = Timer
|
||||
While hDest.X < 0
|
||||
|
|
|
@ -1693,7 +1693,7 @@ void MyMainWindow::present(QWidget *parent)
|
|||
activateWindow();
|
||||
if (parent)
|
||||
X11_set_transient_for(effectiveWinId(), parent->effectiveWinId());
|
||||
if (parent || THIS->stacking == 1)
|
||||
//if (parent || THIS->stacking == 1)
|
||||
raise();
|
||||
}
|
||||
|
||||
|
|
|
@ -231,16 +231,13 @@ void *GB_SubCollectionContainer(void *_object)
|
|||
|
||||
void GB_SubCollectionAdd(void *_object, const char *key, int len, void *value)
|
||||
{
|
||||
void *old_value = NULL;
|
||||
|
||||
if (len <= 0)
|
||||
len = strlen(key);
|
||||
|
||||
GB.Ref(value);
|
||||
GB_SubCollectionRemove(THIS, key, len);
|
||||
//fprintf(stderr, "GB_SubCollectionAdd: insert %p '%.*s'\n", value, len, key);
|
||||
GB.HashTable.Get(THIS->hash_table, key, len, &old_value);
|
||||
GB.HashTable.Add(THIS->hash_table, key, len, value);
|
||||
GB.Ref(value);
|
||||
GB.Unref(&old_value);
|
||||
}
|
||||
|
||||
void GB_SubCollectionRemove(void *_object, const char *key, int len)
|
||||
|
|
Loading…
Reference in a new issue